summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2016-12-15 14:55:10 +0100
committerPatrick Georgi <pgeorgi@google.com>2016-12-16 15:55:18 +0100
commit856a3ab7c7c216a90b8ae45d6a0931a8eb3b7d20 (patch)
treeda9158e11efafc8f5e32749eec4361289484f078
parent5f771dca27dd54c1eb5857344caf235cab83e568 (diff)
downloadcoreboot-856a3ab7c7c216a90b8ae45d6a0931a8eb3b7d20.tar.xz
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>
-rw-r--r--util/broadcom/secimage/misc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/broadcom/secimage/misc.c b/util/broadcom/secimage/misc.c
index a64c448741..fa9f8c5088 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) {