summaryrefslogtreecommitdiff
path: root/layout.c
diff options
context:
space:
mode:
authoruwe <uwe@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2008-12-22 16:42:59 +0000
committeruwe <uwe@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2008-12-22 16:42:59 +0000
commit66efd70a63f758c5509d7be095331e3c7a331bd3 (patch)
treebb2cdf585ae0b6943587505ecb11079d5c6a0324 /layout.c
parenta7faf70edd9194501a2159e5342d52e92b4dc3ac (diff)
downloadflashrom-66efd70a63f758c5509d7be095331e3c7a331bd3.tar.gz
Original v2 revision: 3834
If you pass a bogus layout file to the -l option flashrom will segfault. Fix that by throwing an error instead. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@370 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'layout.c')
-rw-r--r--layout.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/layout.c b/layout.c
index ef09582..e2be12e 100644
--- a/layout.c
+++ b/layout.c
@@ -156,6 +156,11 @@ int read_romlayout(char *name)
#endif
tstr1 = strtok(tempstr, ":");
tstr2 = strtok(NULL, ":");
+ if (!tstr1 || !tstr2) {
+ fprintf(stderr, "Error parsing layout file.\n");
+ fclose(romlayout);
+ return 1;
+ }
rom_entries[romimages].start = strtol(tstr1, (char **)NULL, 16);
rom_entries[romimages].end = strtol(tstr2, (char **)NULL, 16);
rom_entries[romimages].included = 0;