From 58783e395f7f46c04448eee4c0cbde26bffd7fc5 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Mon, 22 Dec 2008 16:42:59 +0000 Subject: If you pass a bogus layout file to the -l option flashrom will segfault Fix that by throwing an error instead. Corresponding to flashrom svn r370 and coreboot v2 svn r3834. Signed-off-by: Uwe Hermann Acked-by: Carl-Daniel Hailfinger Acked-by: Peter Stuge --- layout.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/layout.c b/layout.c index ef0958286..e2be12e9a 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; -- cgit v1.2.3