nvramtool: make sure that strings are 0-terminated

The call site expects them to be.

Change-Id: Ic05fc5831f5743d94fe617dfb3b9e329f01866d1
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: http://review.coreboot.org/7621
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
Patrick Georgi 2014-12-01 22:09:33 +01:00
parent 10b3994f1a
commit 59ab4e99ee

View file

@ -128,7 +128,7 @@ unsigned long long cmos_read(const cmos_entry_t * e)
result = 0;
if (e->config == CMOS_ENTRY_STRING) {
int strsz = (length + 7) / 8;
int strsz = (length + 7) / 8 + 1;
char *newstring = malloc(strsz);
unsigned usize = (8 * sizeof(unsigned long long));