mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
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 <uwe@hermann-uwe.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Peter Stuge <peter@stuge.se>
This commit is contained in:
parent
0ab4298558
commit
58783e395f
5
layout.c
5
layout.c
@ -156,6 +156,11 @@ int read_romlayout(char *name)
|
|||||||
#endif
|
#endif
|
||||||
tstr1 = strtok(tempstr, ":");
|
tstr1 = strtok(tempstr, ":");
|
||||||
tstr2 = strtok(NULL, ":");
|
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].start = strtol(tstr1, (char **)NULL, 16);
|
||||||
rom_entries[romimages].end = strtol(tstr2, (char **)NULL, 16);
|
rom_entries[romimages].end = strtol(tstr2, (char **)NULL, 16);
|
||||||
rom_entries[romimages].included = 0;
|
rom_entries[romimages].included = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user