From 0e538b09311a8ca2d6d4af984580d3961bc91fe0 Mon Sep 17 00:00:00 2001 From: Henry Jung Date: Wed, 8 Feb 2023 07:54:08 -0500 Subject: [PATCH] fix: strchr check --- desmume/src/Database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desmume/src/Database.cpp b/desmume/src/Database.cpp index 1a0d3ca43..519c9985d 100644 --- a/desmume/src/Database.cpp +++ b/desmume/src/Database.cpp @@ -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; }