summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-07-27 01:08:15 +0300
committerAndrei Karas <akaras@inbox.ru>2017-07-27 01:40:12 +0300
commit415860ebaeb990c0c8da27cc7aa565a137b97fe9 (patch)
tree379bc512894f445da63207d58c0956ea503a5f01 /src/map/npc.c
parent30ba171e28b10c5f9355cab5902fa311a234d833 (diff)
downloadhercules-415860ebaeb990c0c8da27cc7aa565a137b97fe9.tar.gz
hercules-415860ebaeb990c0c8da27cc7aa565a137b97fe9.tar.bz2
hercules-415860ebaeb990c0c8da27cc7aa565a137b97fe9.tar.xz
hercules-415860ebaeb990c0c8da27cc7aa565a137b97fe9.zip
Fix possible buffer overflows with snprintf.
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index a358fd2fb..38996a0a3 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2724,10 +2724,10 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short
flag = 1;
if (flag == 1)
- snprintf(nd->exname, ARRAYLENGTH(nd->exname), "warp_%d_%d_%d", from_mapid, from_x, from_y);
+ safesnprintf(nd->exname, ARRAYLENGTH(nd->exname), "warp_%d_%d_%d", from_mapid, from_x, from_y);
for( i = 0; npc->name2id(nd->exname) != NULL; ++i )
- snprintf(nd->exname, ARRAYLENGTH(nd->exname), "warp%d_%d_%d_%d", i, from_mapid, from_x, from_y);
+ safesnprintf(nd->exname, ARRAYLENGTH(nd->exname), "warp%d_%d_%d_%d", i, from_mapid, from_x, from_y);
safestrncpy(nd->name, nd->exname, ARRAYLENGTH(nd->name));
nd->u.warp.mapindex = to_mapindex;