From 9b903d3ac3a9ca6d4111210cee73b59354a6a271 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 20 Mar 2017 19:58:13 +0300 Subject: Add comment to safestrncpy about size checks. --- src/common/strlib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/common/strlib.c b/src/common/strlib.c index 75ce2a272..df8093456 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -344,6 +344,7 @@ int strlib_config_switch(const char *str) { } /// strncpy that always null-terminates the string +/// @remark this function will read at most `n` - 1 bytes from `src` (from 0 to `n` - 2) char *strlib_safestrncpy(char *dst, const char *src, size_t n) { if( n > 0 ) -- cgit v1.2.3-70-g09d2 From 1885e79a35b841b0f720d461171f00e1c4e7fa63 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 20 Mar 2017 17:47:55 +0300 Subject: Fix npc text input For 2015 clients (Fixes #1640). Based on ragemu commit: commit a7ff9d064b238f5c2c4947f41eeaa0bfe331f2e6 Author: athron98 Date: Mon May 23 20:36:43 2016 +0700 input fix --- src/map/clif.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 597a890ae..8fae28e74 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11626,7 +11626,12 @@ void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute_ /// 01d5 .W .L .?B void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) { - int message_len = RFIFOW(fd,2)-8; +// [4144] can't confirm exact client version. At least >= correct for 20150513 +#if PACKETVER >= 20151029 + int message_len = RFIFOW(fd, 2) - 7; +#else + int message_len = RFIFOW(fd, 2) - 8; +#endif int npcid = RFIFOL(fd,4); const char *message = RFIFOP(fd,8); -- cgit v1.2.3-70-g09d2