diff options
author | Patrick Georgi <pgeorgi@chromium.org> | 2016-12-15 14:55:10 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2016-12-16 15:55:18 +0100 |
commit | 856a3ab7c7c216a90b8ae45d6a0931a8eb3b7d20 (patch) | |
tree | da9158e11efafc8f5e32749eec4361289484f078 /util/broadcom/secimage | |
parent | 5f771dca27dd54c1eb5857344caf235cab83e568 (diff) |
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>
Diffstat (limited to 'util/broadcom/secimage')
-rw-r--r-- | util/broadcom/secimage/misc.c | 3 |
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) { |