Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/70006 )
Change subject: layout: Check return values for strdup in register_include_arg ......................................................................
layout: Check return values for strdup in register_include_arg
Ticket: https://ticket.coreboot.org/issues/372
Change-Id: I6c22196be6847a8c9704f1de936604a51b4b8a28 Signed-off-by: Anastasia Klimchuk aklm@chromium.org --- M layout.c 1 file changed, 17 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/06/70006/1
diff --git a/layout.c b/layout.c index be88428..7a4d881 100644 --- a/layout.c +++ b/layout.c @@ -136,6 +136,11 @@ name = colon ? strndup(arg, colon - arg) : strdup(arg); file = colon ? strdup(colon + 1) : NULL;
+ if (name == NULL || file == NULL) { + msg_gerr("Could not allocate memory\n"); + goto error; + } + for (tmp = *args; tmp; tmp = tmp->next) { if (!strcmp(tmp->name, name)) { msg_gerr("Duplicate region name: "%s".\n", name);