Make sure optionroms have a non-zero size before using them.
authorKevin O'Connor <kevin@koconnor.net>
Mon, 13 Apr 2009 23:19:22 +0000 (19:19 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 13 Apr 2009 23:19:22 +0000 (19:19 -0400)
src/optionroms.c

index 6bc28fa6e490b7411888f28e67cb95bc263a9ba9..f3c4cfd3830bb31a792d67920f3b732c1920496f 100644 (file)
@@ -113,6 +113,8 @@ is_valid_rom(struct rom_header *rom)
 {
     if (rom->signature != OPTION_ROM_SIGNATURE)
         return 0;
+    if (! rom->size)
+        return 0;
     u32 len = rom->size * 512;
     u8 sum = checksum(rom, len);
     if (sum != 0) {