summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authoramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-17 06:30:36 +0000
committeramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-17 06:30:36 +0000
commit7ddbedc2077a747ecf1e034566493d4a470cb4d7 (patch)
tree47715a3f01cb851c675ea4f354f380a0e5b820f6 /src/map/map.c
parent5f4b632f3a99d56870ce1b58a7f72d13dabfc5af (diff)
downloadhercules-7ddbedc2077a747ecf1e034566493d4a470cb4d7.tar.gz
hercules-7ddbedc2077a747ecf1e034566493d4a470cb4d7.tar.bz2
hercules-7ddbedc2077a747ecf1e034566493d4a470cb4d7.tar.xz
hercules-7ddbedc2077a747ecf1e034566493d4a470cb4d7.zip
Fixed memory corruption
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1241 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 066427111..1ee3840c7 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1729,15 +1729,14 @@ int map_mapname2mapid(char *name) {
md = (struct map_data*)strdb_search(map_db,name);
- #ifdef USE_AFM
- // If we can't find the .gat map try .afm instead [celest]
- if(md==NULL && strstr(name,".gat")) {
- char afm_name[16] = "";
- strncpy(afm_name, name, strlen(name) - 4);
- strcat(afm_name, ".afm");
- md = (struct map_data*)strdb_search(map_db,afm_name);
- }
- #endif
+#ifdef USE_AFM
+ // If we can't find the .gat map try .afm instead [celest]
+ if(md==NULL && strstr(name,".gat")) {
+ char *afm_name = strdup(name);
+ strcpy(&afm_name[strlen(name) - 3], "afm");
+ md = (struct map_data*)strdb_search(map_db,afm_name);
+ }
+#endif
if(md==NULL || md->gat==NULL)
return -1;