Author: uwe Date: 2008-12-22 17:42:59 +0100 (Mon, 22 Dec 2008) New Revision: 3834
Modified: trunk/util/flashrom/layout.c Log: 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
Modified: trunk/util/flashrom/layout.c =================================================================== --- trunk/util/flashrom/layout.c 2008-12-22 16:40:45 UTC (rev 3833) +++ trunk/util/flashrom/layout.c 2008-12-22 16:42:59 UTC (rev 3834) @@ -156,6 +156,11 @@ #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;