summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-01-19 10:07:37 +0000
committerJared Adams <jaxad0127@gmail.com>2009-01-19 10:08:37 +0000
commita8c8788b308025c46472f9036cd0b7430d5e8a9b (patch)
tree2fbb6fd207c004f31378b6900e109cdb4d7e99b2 /src/map/clif.c
parent50cbe6ac7c164a759e2ac50e14c67c1b912589f7 (diff)
downloadtmwa-a8c8788b308025c46472f9036cd0b7430d5e8a9b.tar.gz
tmwa-a8c8788b308025c46472f9036cd0b7430d5e8a9b.tar.bz2
tmwa-a8c8788b308025c46472f9036cd0b7430d5e8a9b.tar.xz
tmwa-a8c8788b308025c46472f9036cd0b7430d5e8a9b.zip
Fix NPC string input to read the amount claimed
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c7
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));
}