From b2955673dcf3be8f599b478c43e2e43b371a9706 Mon Sep 17 00:00:00 2001 From: Luke1410 Date: Mon, 16 Sep 2019 00:53:59 +0200 Subject: [PATCH] - fixed buffer overrun in PacketizedTCP::SendList() resulting in potential leaking arbitrary data --- Source/PacketizedTCP.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/PacketizedTCP.cpp b/Source/PacketizedTCP.cpp index e84dcd2b5..f427b8336 100644 --- a/Source/PacketizedTCP.cpp +++ b/Source/PacketizedTCP.cpp @@ -11,11 +11,15 @@ #include "NativeFeatureIncludes.h" #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1 +#include // used for std::min #include "PacketizedTCP.h" #include "NativeTypes.h" #include "BitStream.h" #include "MessageIdentifiers.h" #include "RakAlloca.h" +#ifdef min +#undef min +#endif using namespace RakNet; @@ -96,7 +100,7 @@ bool PacketizedTCP::SendList( const char **data, const unsigned int *lengths, co dataArray[i+1]=data[i]; lengthsArray[i+1]=lengths[i]; } - return TCPInterface::SendList(dataArray,lengthsArray,numParameters+1,systemAddress,broadcast); + return TCPInterface::SendList(dataArray, lengthsArray, std::min(numParameters, 511) + 1, systemAddress, broadcast); } void PacketizedTCP::PushNotificationsToQueues(void) {