diff options
-rw-r--r-- | src/map/clif.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index fb74cb5..b7bcfc1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8611,14 +8611,17 @@ void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) */ void clif_parse_NpcStringInput(int fd,struct map_session_data *sd) { + int len; nullpo_retv(sd); - if(RFIFOW(fd,2)-7 >= sizeof(sd->npc_str)){ + len = RFIFOW(fd,2)-7; + + if(len >= sizeof(sd->npc_str)){ printf("clif: input string too long !\n"); memcpy(sd->npc_str,RFIFOP(fd,8),sizeof(sd->npc_str)); sd->npc_str[sizeof(sd->npc_str)-1]=0; } else - strcpy(sd->npc_str,RFIFOP(fd,8)); + strncpy(sd->npc_str,RFIFOP(fd,8), len); map_scriptcont(sd,RFIFOL(fd,4)); } |