mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Fix improperly terminated region name check (#953)
This commit is contained in:
@@ -281,13 +281,12 @@ static void parseScrambleSpec(char const *spec)
|
|||||||
// Now, determine which region type this is
|
// Now, determine which region type this is
|
||||||
enum ScrambledRegion region = 0;
|
enum ScrambledRegion region = 0;
|
||||||
|
|
||||||
while (region < SCRAMBLE_UNK) {
|
for (; region < SCRAMBLE_UNK; region++) {
|
||||||
// If the strings match (case-insensitively), we got it!
|
// If the strings match (case-insensitively), we got it!
|
||||||
// It's OK not to use `strncasecmp` because `regionName` is still
|
// `strncasecmp` must be used here since `regionName` points
|
||||||
// NUL-terminated, since the encompassing spec is.
|
// to the entire remaining argument.
|
||||||
if (!strcasecmp(scrambleSpecs[region].name, regionName))
|
if (!strncasecmp(scrambleSpecs[region].name, regionName, regionNameLen))
|
||||||
break;
|
break;
|
||||||
region++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (region == SCRAMBLE_UNK)
|
if (region == SCRAMBLE_UNK)
|
||||||
|
|||||||
Reference in New Issue
Block a user