[Mesa-dev] [PATCH 07/11] intel/tools/error: Fix null termination of ring name string.

Kenneth Graunke kenneth at whitecape.org
Sun Nov 12 08:35:08 UTC 2017


Ported from intel_error_decode.  We don't want to run off the end.
---
 src/intel/tools/aubinator_error_decode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c
index 9cd0fa761dd..f9d14cc20d5 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -559,6 +559,7 @@ read_data_file(FILE *file)
          free(ring_name);
          ring_name = malloc(dashes - line);
          strncpy(ring_name, line, dashes - line);
+         ring_name[dashes - line - 1] = '\0';
 
          dashes += 4;
          for (b = buffers; b->match; b++) {
-- 
2.15.0



More information about the mesa-dev mailing list