Merge pull request #632 from hjung4/fix/strchr-oob-check
Fix out-of-bounds index access
This commit is contained in:
commit
23400431a1
|
@ -374,7 +374,7 @@ namespace Database
|
||||||
size_t regions_num = ARRAY_SIZE(regions);
|
size_t regions_num = ARRAY_SIZE(regions);
|
||||||
|
|
||||||
const char* found = strchr(regions_index,code);
|
const char* found = strchr(regions_index,code);
|
||||||
if(found) return regions[found-regions_index];
|
if(found && found-regions_index < strlen(regions_index)) return regions[found-regions_index];
|
||||||
else return unknownAsString ? "???" : NULL;
|
else return unknownAsString ? "???" : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue