Previous 199869 Revisions Next

r31643 Wednesday 13th August, 2014 at 18:01:54 UTC by Wilbert Pol
(MESS) sega8_slot.c: Prevent out of bound access when determining the cart type for small (homebrew) rom files. (nw)
[src/emu/bus/sega8]sega8_slot.c

trunk/src/emu/bus/sega8/sega8_slot.c
r31642r31643
582582   }
583583
584584   // Terebi Oekaki (TV Draw)
585   if (!strncmp((const char *)&ROM[0x13b3], "annakmn", 7))
585   if (len >= 0x13b3 + 7 && !strncmp((const char *)&ROM[0x13b3], "annakmn", 7))
586586      type = SEGA8_TEREBIOEKAKI;
587587
588588   // The Castle (ROM+RAM)
589   if (!strncmp((const char *)&ROM[0x1cc3], "ASCII 1986", 10))
589   if (len >= 0x1cc3 + 10 && !strncmp((const char *)&ROM[0x1cc3], "ASCII 1986", 10))
590590      type = SEGA8_CASTLE;
591591
592592   // BASIC Level 3
593   if (!strncmp((const char *)&ROM[0x6a20], "SC-3000 BASIC Level 3 ver 1.0", 29))
593   if (len >= 0x6a20 + 29 && !strncmp((const char *)&ROM[0x6a20], "SC-3000 BASIC Level 3 ver 1.0", 29))
594594      type = SEGA8_BASIC_L3;
595595
596596   // Music Editor
597   if (!strncmp((const char *)&ROM[0x0841], "PIANO", 5) || !strncmp((const char *)&ROM[0x0841], "music", 5))
598      type = SEGA8_MUSIC_EDITOR;
597   if (len >= 0x0841 + 5)
598   {
599      if (!strncmp((const char *)&ROM[0x0841], "PIANO", 5) || !strncmp((const char *)&ROM[0x0841], "music", 5))
600         type = SEGA8_MUSIC_EDITOR;
601   }
599602
600603
601604   return type;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team