From: <bo...@us...> - 2003-11-22 02:39:26
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv6467 Modified Files: Ed2kSocket.cpp Log Message: Fixed bug, which caused an attempt to allocate 4G of RAM if an ed2k packet with size 0 is being received Index: Ed2kSocket.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kSocket.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Ed2kSocket.cpp 20 Nov 2003 16:27:25 -0000 1.5 +++ Ed2kSocket.cpp 22 Nov 2003 02:39:23 -0000 1.6 @@ -189,6 +189,14 @@ } in_SumPacketSizes-=in_Ed2kPacketSize+5; + if (!in_Ed2kPacketSize) { + return; + /* + * FIXME: throw an exception, close the socket, let + * the computer explode etc. ... + */ + } + ed2kpacket.SetData(in_protocol,*(data+5),in_Ed2kPacketSize-1,data+6); in_Ed2kPacketSize=0xffffffff; |