intel/tools/error: Fix null termination of ring name string.
authorKenneth Graunke <kenneth@whitecape.org>
Sun, 12 Nov 2017 06:51:07 +0000 (22:51 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 14 Nov 2017 01:11:01 +0000 (17:11 -0800)
Ported from intel_error_decode.  We don't want to run off the end.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
src/intel/tools/aubinator_error_decode.c

index 9cd0fa761ddfecaacee5393e31322f7f56a6f79d..f9d14cc20d55c5ccdcaa5bb510f567253c0a3e07 100644 (file)
@@ -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++) {