diff options
author | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2019-11-18 13:56:08 +0200 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2019-11-19 12:53:22 +0200 |
commit | a70013186d3060cfd15d9640fd9a4c360d477c08 (patch) | |
tree | f102f4061e8583bd04ca8b323196083d364250f2 /tests/syncobj_basic.c | |
parent | 4bb46f08f7cb6485642c4351cecdad93072d27a0 (diff) |
tests/tools_test: Use readlink() properly
Turns out that `readlink()` does not NULL-terminate the string and since
it resides on the stack we may end up with some junk:
`/proc/self/exe point to /opt/igt/libexec/igt-gpu-tools/tools_test7<CD>\t<8A>^?`
That in turn confuses `dirname()` and we end up doing `chdir("/")`,
which explain the sporadic failures of this test where it was not able
to locate the tools.
Let's zero out the variable first and allow `readlink()` to write at
most `sizeof()-1` bytes to it, so it is always properly terminated.
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
Issue: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/12
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/syncobj_basic.c')
0 files changed, 0 insertions, 0 deletions