Stop reading layout info when the max layout count has been reached
Corresponding to flashrom svn r1243.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
diff --git a/layout.c b/layout.c
index 9ad2f5c..92fe852 100644
--- a/layout.c
+++ b/layout.c
@@ -152,6 +152,14 @@
while (!feof(romlayout)) {
char *tstr1, *tstr2;
+
+ if (romimages >= MAX_ROMLAYOUT) {
+ msg_gerr("Maximum number of ROM images (%i) in layout "
+ "file reached before end of layout file.\n",
+ MAX_ROMLAYOUT);
+ msg_gerr("Ignoring the rest of the layout file.\n");
+ break;
+ }
if (2 != fscanf(romlayout, "%s %s\n", tempstr, rom_entries[romimages].name))
continue;
#if 0