From 59ab4e99ee9553cc472970656ee85dc255f502b7 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 1 Dec 2014 22:09:33 +0100 Subject: nvramtool: make sure that strings are 0-terminated The call site expects them to be. Change-Id: Ic05fc5831f5743d94fe617dfb3b9e329f01866d1 Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/7621 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan --- util/nvramtool/cmos_lowlevel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/nvramtool/cmos_lowlevel.c b/util/nvramtool/cmos_lowlevel.c index c46e48062d..32f0e0a680 100644 --- a/util/nvramtool/cmos_lowlevel.c +++ b/util/nvramtool/cmos_lowlevel.c @@ -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)); -- cgit v1.2.3