Merge pull request #632 from hjung4/fix/strchr-oob-check

Fix out-of-bounds index access
This commit is contained in:
zeromus 2023-02-08 12:25:41 -06:00 committed by GitHub
commit 23400431a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -374,7 +374,7 @@ namespace Database
size_t regions_num = ARRAY_SIZE(regions);
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;
}