Explorar o código

Merge pull request #1001 from secretdataz/fix/message

Fixed chat message that already have zero termination being misinterpreted as corrupted packets.
This issue was reported on #1000 by @secretdataz and was on clients from 2015-10-01 onwards and was mainly caused by Frost Joke.

Thanks to @secretdataz for additionally providing a fix for it in this pull request too.
Lemongrass3110 %!s(int64=9) %!d(string=hai) anos
pai
achega
fb4cf3e5e3
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      src/map/clif.c

+ 4 - 1
src/map/clif.c

@@ -9803,7 +9803,10 @@ static bool clif_process_message(struct map_session_data* sd, int format, char**
 	}
 
 #if PACKETVER >= 20151001
-	message[messagelen++] = '\0';
+	if (message[messagelen-1] != '\0')
+	{
+		message[messagelen++] = '\0';
+	}
 #endif
 
 	// the declared length must match real length