From f0aa0e5b60d8f86c2176428ed216dc7a1cac46cb Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Sun, 17 Apr 2016 22:31:19 +0200 Subject: [PATCH] Fixed the unknown packets on clients from october 2015 onwards Sorry guys, we actually created this issue ourselves, because we overwrote the data of the next incoming packet eventually. Maybe this will make 2015-10-29 also useable again. Fixes #1049. --- src/map/clif.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/map/clif.c b/src/map/clif.c index 9009d53254..37efce1122 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9796,13 +9796,7 @@ static bool clif_process_message(struct map_session_data* sd, int format, char** messagelen = textlen - NAME_LENGTH; // this should be the message length (w/ zero byte included) } -#if PACKETVER >= 20151001 - if (message[messagelen-1] != '\0') - { - message[messagelen++] = '\0'; - } -#endif - +#if PACKETVER < 20151001 // the declared length must match real length if( messagelen != strnlen(message, messagelen)+1 ) { ShowWarning("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n", sd->status.name); @@ -9814,6 +9808,7 @@ static bool clif_process_message(struct map_session_data* sd, int format, char** ShowWarning("clif_process_message: Player '%s' sent an unterminated message string!\n", sd->status.name); return false; } +#endif // messages mustn't be too long if( messagelen > CHAT_SIZE_MAX-1 ) {