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:
@@ -128,7 +128,7 @@ unsigned long long cmos_read(const cmos_entry_t * e)
|
|||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
if (e->config == CMOS_ENTRY_STRING) {
|
if (e->config == CMOS_ENTRY_STRING) {
|
||||||
int strsz = (length + 7) / 8;
|
int strsz = (length + 7) / 8 + 1;
|
||||||
char *newstring = malloc(strsz);
|
char *newstring = malloc(strsz);
|
||||||
unsigned usize = (8 * sizeof(unsigned long long));
|
unsigned usize = (8 * sizeof(unsigned long long));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user