Anastasia Klimchuk has uploaded this change for review.

View Change

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);

To view, visit change 70006. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6c22196be6847a8c9704f1de936604a51b4b8a28
Gerrit-Change-Number: 70006
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-MessageType: newchange