fix yet another portability issue
[picodrive.git] / pico / cart.c
index db742a8..6a835b6 100644 (file)
@@ -643,6 +643,8 @@ static int rom_strcmp(int rom_offset, const char *s1)
 {\r
   int i, len = strlen(s1);\r
   const char *s_rom = (const char *)Pico.rom;\r
+  if (rom_offset + len > Pico.romsize)\r
+    return 0;\r
   for (i = 0; i < len; i++)\r
     if (s1[i] != s_rom[(i + rom_offset) ^ 1])\r
       return 1;\r
@@ -897,10 +899,13 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram)
         SRam.flags &= ~SRF_EEPROM;\r
       else if (strcmp(p, "filled_sram") == 0)\r
         *fill_sram = 1;\r
+      else if (strcmp(p, "force_6btn") == 0)\r
+        PicoQuirks |= PQUIRK_FORCE_6BTN;\r
       else {\r
         elprintf(EL_STATUS, "carthw:%d: unsupported prop: %s", line, p);\r
         goto bad_nomsg;\r
       }\r
+      elprintf(EL_STATUS, "game prop: %s", p);\r
       continue;\r
     }\r
     else if (is_expr("eeprom_type", &p)) {\r