summaryrefslogtreecommitdiff
path: root/util/flashrom
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2008-12-22 16:42:59 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2008-12-22 16:42:59 +0000
commit29fbb761ec559b22b7aa9a4b6cb88409545b40c4 (patch)
treecea1553b605035fe2341afeca179dbf9538d9907 /util/flashrom
parentfdc5470bcf21eb6e2f8c720bfc3f436357fe3209 (diff)
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: svn://svn.coreboot.org/coreboot/trunk@3834 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/flashrom')
-rw-r--r--util/flashrom/layout.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/flashrom/layout.c b/util/flashrom/layout.c
index ef0958286f..e2be12e9a9 100644
--- a/util/flashrom/layout.c
+++ b/util/flashrom/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;