mgmt-tester: Fix buffer overrun

Error: OVERRUN (CWE-119): [#def56] [important]
tools/mgmt-tester.c:12674:2: overrun-local:
Overrunning array "buf" of 513 bytes at byte offset 513 using
index "read + 1" (which evaluates to 513).
12672|		}
12673|		/* Make sure buf is nul-terminated */
12674|->	buf[read + 1] = '\0';
12675|
12676|		/* Verify if all devcoredump header fields are present */

Fixes: 49d0656069 ("mgmt-tester: Fix non-nul-terminated string")
This commit is contained in:
Bastien Nocera 2024-05-30 16:57:56 +02:00 committed by Luiz Augusto von Dentz
parent 24cf049395
commit aa54087f13

View File

@ -12671,7 +12671,7 @@ static void verify_devcd(void *user_data)
return;
}
/* Make sure buf is nul-terminated */
buf[read + 1] = '\0';
buf[read] = '\0';
/* Verify if all devcoredump header fields are present */
line = strtok_r(buf, delim, &saveptr);