summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2014-04-16 17:05:43 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2014-04-16 19:21:17 +0300
commit78e4c2b449c6d0a18e2bfaea29f3a0eadb42c5f3 (patch)
tree27a4d8ffcfeb5c913e0997c0329919fef614cf3a /lib
parent4aa2c102b933d11cc85e0dc6fe607924e248b652 (diff)
lib: Fix potential out of bounds access in ring stop code
The subsequet code expects the read() to not have filled the entire buffer, and yet we allow it to do so. Reduce the size passed to read() by 1 to make the code sane. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_debugfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 52b8e2fe..4fd2e5aa 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -666,7 +666,7 @@ enum stop_ring_flags igt_get_stop_rings(void)
fd = igt_debugfs_open("i915_ring_stop", O_RDONLY);
igt_assert(fd >= 0);
- l = read(fd, buf, sizeof(buf));
+ l = read(fd, buf, sizeof(buf)-1);
igt_assert(l > 0);
igt_assert(l < sizeof(buf));