intel/tools/error: Fix null termination of ring name string.

Ported from intel_error_decode.  We don't want to run off the end.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Kenneth Graunke 2017-11-11 22:51:07 -08:00
parent ac17b38e79
commit eb8ad56ed2
1 changed files with 1 additions and 0 deletions

View 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++) {