libpayload/options: Fix out of array read.
It resulted in garbage in upper bytes of numeric options. Change-Id: I5e5d8b770ed93c7e8a1756a5ce32444b6a045bac Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/4691 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
parent
fd5b370437
commit
7ea00155b2
|
@ -310,6 +310,10 @@ int get_option_as_string(const struct nvram_accessor *nvram, struct cb_cmos_opti
|
|||
return 1;
|
||||
int cmos_length = (cmos_entry->length+7)/8;
|
||||
|
||||
/* ensure we have enough space for u64 */
|
||||
if (cmos_length < 8)
|
||||
cmos_length = 8;
|
||||
|
||||
/* extra byte to ensure 0-terminated strings */
|
||||
raw = malloc(cmos_length+1);
|
||||
memset(raw, 0, cmos_length+1);
|
||||
|
|
Loading…
Reference in New Issue