From a8c8788b308025c46472f9036cd0b7430d5e8a9b Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 19 Jan 2009 10:07:37 +0000 Subject: Fix NPC string input to read the amount claimed --- src/map/clif.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/map/clif.c') 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)); } -- cgit v1.2.3-70-g09d2