[igt-dev] [PATCH i-g-t 3/5] lib/debugfs: Ensure null-termination in igt_hpd_storm_detected
Petri Latvala
petri.latvala at intel.com
Thu Mar 7 11:24:25 UTC 2019
Read sizeof - 1 to buf so it stays null-terminated.
Signed-off-by: Petri Latvala <petri.latvala at intel.com>
---
lib/igt_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 640c78e9..b0e5cfa5 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -628,7 +628,7 @@ bool igt_hpd_storm_detected(int drm_fd)
if (fd < 0)
return false;
- igt_assert_lt(0, read(fd, buf, sizeof(buf)));
+ igt_assert_lt(0, read(fd, buf, sizeof(buf) - 1));
igt_assert(start_loc = strstr(buf, "Detected: "));
igt_assert_eq(sscanf(start_loc, "Detected: %s\n", detected_str), 1);
--
2.19.1
More information about the igt-dev
mailing list