util/broadcom: Terminate string

filebuffer is treated like a string, so it should be zero-terminated
like a string.

Change-Id: I078aa39906394be64023424731fe0c7ae2019899
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Found-by: Coverity Scan #1323473
Reviewed-on: https://review.coreboot.org/17878
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Patrick Georgi 2016-12-15 14:55:10 +01:00 committed by Patrick Georgi
parent 5f771dca27
commit 856a3ab7c7
1 changed files with 2 additions and 1 deletions

View File

@ -15,7 +15,7 @@
#include <string.h>
#include "secimage.h"
static unsigned char filebuffer[2048];
static unsigned char filebuffer[2049];
void FillHeaderFromConfigFile(char *h, char *ConfigFileName)
{
@ -32,6 +32,7 @@ void FillHeaderFromConfigFile(char *h, char *ConfigFileName)
if (fp != NULL) {
printf("\r\n Reading config information from file \r\n");
byte_count = fread(filebuffer, 1, 2048, fp);
filebuffer[2048] = 0;
if (byte_count > 0) {
ptr = strstr((char *)filebuffer, "Tag=");
if (ptr) {