summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r--payloads/libpayload/drivers/options.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/options.c b/payloads/libpayload/drivers/options.c
index 70c2b1760d..2b0a42e1b7 100644
--- a/payloads/libpayload/drivers/options.c
+++ b/payloads/libpayload/drivers/options.c
@@ -357,7 +357,11 @@ int set_option_from_string(const struct nvram_accessor *nvram, struct cb_cmos_op
*(u64*)raw = strtoull(value, NULL, 0);
break;
case 's':
- raw = strdup(value);
+ raw = malloc(cmos_entry->length);
+ if (!raw)
+ return 1;
+ memset(raw, 0x00, cmos_entry->length);
+ strncpy(raw, value, cmos_entry->length);
break;
case 'e':
cmos_enum = lookup_cmos_enum_by_label(option_table, cmos_entry->config_id, value);