From bfb6b831f8b469a47aa755b28eb846277b4f1530 Mon Sep 17 00:00:00 2001 From: keitenai Date: Fri, 22 Feb 2019 00:25:58 +0800 Subject: [PATCH] Minor clean up in `clif_displaymessage` function (#3957) * Clean up `clif_displaymessage` function --- src/map/clif.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 1923c326d5..64b74c77c7 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -6177,11 +6177,11 @@ void clif_displaymessage(const int fd, const char* mes) message = aStrdup(mes); line = strtok(message, "\n"); + while(line != NULL) { #if PACKETVER == 20141022 /** for some reason game client crashes depending on message pattern (only for this packet) **/ /** so we redirect to ZC_NPC_CHAT **/ //clif_messagecolor(&sd->bl, color_table[COLOR_DEFAULT], mes, false, SELF); - while(line != NULL) { unsigned long color = (color_table[COLOR_DEFAULT] & 0x0000FF) << 16 | (color_table[COLOR_DEFAULT] & 0x00FF00) | (color_table[COLOR_DEFAULT] & 0xFF0000) >> 16; // RGB to BGR unsigned short len = strnlen(line, CHAT_SIZE_MAX); @@ -6195,7 +6195,6 @@ void clif_displaymessage(const int fd, const char* mes) WFIFOSET(fd, WFIFOW(fd, 2)); } #else - while(line != NULL) { // Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client) int len = strnlen(line, CHAT_SIZE_MAX);