Proto_OpenVPN.c: fix segmentation fault in OvsProceccRecvPacket()
OvsDecrypt() returns 0 when it fails, resulting in "size" rolling over with an end result of
This commit fixes the issue by checking whether "size" is greater than sizeof(UINT) before performing the subtraction.
@@ -681,11 +681,13 @@ void OvsProceccRecvPacket(OPENVPN_SERVER *s, UDPPACKET *p)
{
// Decrypt
size = OvsDecrypt(c->CipherDecrypt, c->MdRecv, c->IvRecv, data, recv_packet->Data, recv_packet->DataSize);
-
+ if (size > sizeof(UINT))
+ {
// Seek buffer after the packet ID
data += sizeof(UINT);
size -= sizeof(UINT);
}
+ }
// Update of last communication time
se->LastCommTick = s->Now;
