summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-29 15:02:53 +0100
committerHaru <haru@dotalux.com>2016-02-29 15:02:53 +0100
commit5e0b084d84ec91fb373adbc322a0c7ac1c42c15a (patch)
treeeb8442b39f862cf65a160f9587835a0e906b8fcf
parentda2e7b9ec12d784ad3baf8eb824cfb0b6d642302 (diff)
parent40b2a0917977a1f0fe761497a7f9d280e2f97a7d (diff)
downloadhercules-5e0b084d84ec91fb373adbc322a0c7ac1c42c15a.tar.gz
hercules-5e0b084d84ec91fb373adbc322a0c7ac1c42c15a.tar.bz2
hercules-5e0b084d84ec91fb373adbc322a0c7ac1c42c15a.tar.xz
hercules-5e0b084d84ec91fb373adbc322a0c7ac1c42c15a.zip
Merge pull request #1174 from 4144/fixcorruption
Fix buffer overflow in pet rename.
-rw-r--r--src/map/intif.c4
-rw-r--r--src/map/pet.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/map/intif.c b/src/map/intif.c
index d20afbb08..7d2493d46 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -837,8 +837,8 @@ int intif_guild_notice(int guild_id,const char *mes1,const char *mes2)
WFIFOHEAD(inter_fd,186);
WFIFOW(inter_fd,0)=0x303e;
WFIFOL(inter_fd,2)=guild_id;
- memcpy(WFIFOP(inter_fd,6),mes1,MAX_GUILDMES1);
- memcpy(WFIFOP(inter_fd,66),mes2,MAX_GUILDMES2);
+ safestrncpy(WFIFOP(inter_fd, 6), mes1, MAX_GUILDMES1);
+ safestrncpy(WFIFOP(inter_fd, 66), mes2, MAX_GUILDMES2);
WFIFOSET(inter_fd,186);
return 0;
}
diff --git a/src/map/pet.c b/src/map/pet.c
index 71d8d1eb3..256324d29 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -679,7 +679,7 @@ int pet_change_name_ack(struct map_session_data *sd, const char *name, int flag)
aFree(newname);
return 0;
}
- memcpy(pd->pet.name, newname, NAME_LENGTH);
+ safestrncpy(pd->pet.name, newname, NAME_LENGTH);
aFree(newname);
clif->charnameack (0,&pd->bl);
pd->pet.rename_flag = 1;