mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +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
|
||||
enum ScrambledRegion region = 0;
|
||||
|
||||
while (region < SCRAMBLE_UNK) {
|
||||
for (; region < SCRAMBLE_UNK; region++) {
|
||||
// If the strings match (case-insensitively), we got it!
|
||||
// It's OK not to use `strncasecmp` because `regionName` is still
|
||||
// NUL-terminated, since the encompassing spec is.
|
||||
if (!strcasecmp(scrambleSpecs[region].name, regionName))
|
||||
// `strncasecmp` must be used here since `regionName` points
|
||||
// to the entire remaining argument.
|
||||
if (!strncasecmp(scrambleSpecs[region].name, regionName, regionNameLen))
|
||||
break;
|
||||
region++;
|
||||
}
|
||||
|
||||
if (region == SCRAMBLE_UNK)
|
||||
|
||||
Reference in New Issue
Block a user