Verify minimum size of OP_Packet, OP_Fragment and OP_OutOfOrderAck

This commit is contained in:
Derision
2013-04-27 16:22:29 +01:00
parent 401e897019
commit 232d1e2ca8
2 changed files with 16 additions and 0 deletions
+15
View File
@@ -173,6 +173,11 @@ uint32 processed=0,subpacket_length=0;
break;
case OP_Packet: {
if(!p->pBuffer || (p->Size() < 4))
{
_log(NET__ERROR, _L "Received OP_Packet that was of malformed size" __L);
break;
}
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
SeqOrder check=CompareSequence(NextInSeq,seq);
if (check == SeqFuture) {
@@ -218,6 +223,11 @@ uint32 processed=0,subpacket_length=0;
break;
case OP_Fragment: {
if(!p->pBuffer || (p->Size() < 4))
{
_log(NET__ERROR, _L "Received OP_Fragment that was of malformed size" __L);
break;
}
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
SeqOrder check=CompareSequence(NextInSeq,seq);
if (check == SeqFuture) {
@@ -388,6 +398,11 @@ uint32 processed=0,subpacket_length=0;
}
break;
case OP_OutOfOrderAck: {
if(!p->pBuffer || (p->Size() < 4))
{
_log(NET__ERROR, _L "Received OP_OutOfOrderAck that was of malformed size" __L);
break;
}
#ifndef COLLECTOR
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
MOutboundQueue.lock();