diff --git a/src/map.cc b/src/map.cc index 7f565b7..90c2639 100644 --- a/src/map.cc +++ b/src/map.cc @@ -799,7 +799,7 @@ int mapLoadById(int map) scriptSetFixedParam(gMapSid, map); char name[16]; - if (wmMapIdxToName(map, name) == -1) { + if (wmMapIdxToName(map, name, sizeof(name)) == -1) { return -1; } diff --git a/src/worldmap.cc b/src/worldmap.cc index ed4be1b..c481510 100644 --- a/src/worldmap.cc +++ b/src/worldmap.cc @@ -2761,14 +2761,14 @@ int wmMapMaxCount() } // 0x4BF974 -int wmMapIdxToName(int mapIdx, char* dest) +int wmMapIdxToName(int mapIdx, char* dest, size_t size) { if (mapIdx == -1 || mapIdx > wmMaxMapNum) { dest[0] = '\0'; return -1; } - snprintf(dest, sizeof(dest), "%s.MAP", wmMapInfoList[mapIdx].mapFileName); + snprintf(dest, size, "%s.MAP", wmMapInfoList[mapIdx].mapFileName); return 0; } diff --git a/src/worldmap.h b/src/worldmap.h index b6c5fcd..1180d70 100644 --- a/src/worldmap.h +++ b/src/worldmap.h @@ -237,7 +237,7 @@ int wmWorldMap_reset(); int wmWorldMap_save(File* stream); int wmWorldMap_load(File* stream); int wmMapMaxCount(); -int wmMapIdxToName(int mapIdx, char* dest); +int wmMapIdxToName(int mapIdx, char* dest, size_t size); int wmMapMatchNameToIdx(char* name); bool wmMapIdxIsSaveable(int mapIdx); bool wmMapIsSaveable();