Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17878
-gerrit
commit cbf3abdff3c4b942e8ccca3b9ee67800772cf3da Author: Patrick Georgi pgeorgi@chromium.org Date: Thu Dec 15 14:55:10 2016 +0100
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 --- util/broadcom/secimage/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/broadcom/secimage/misc.c b/util/broadcom/secimage/misc.c index a64c448..fa9f8c5 100644 --- a/util/broadcom/secimage/misc.c +++ b/util/broadcom/secimage/misc.c @@ -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) {