mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-12-26 18:19:53 +03:00
Cedar/Connection.c: Fix buffer overflow when inserting NAT-T information
This commit is contained in:
parent
dc296f1eff
commit
f6adcd6bfc
@ -909,20 +909,24 @@ void SendKeepAlive(CONNECTION *c, TCPSOCK *ts)
|
||||
|
||||
if (s->UseUdpAcceleration && udp_accel != NULL)
|
||||
{
|
||||
UINT required_size = 0;
|
||||
|
||||
if (udp_accel->MyPortNatT != 0)
|
||||
{
|
||||
size = MAX(size, (StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE) + sizeof(USHORT)));
|
||||
required_size += StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE) + sizeof(USHORT);
|
||||
|
||||
insert_natt_port = true;
|
||||
}
|
||||
|
||||
if (IsZeroIP(&udp_accel->MyIpNatT) == false)
|
||||
{
|
||||
size = MAX(size, (StrLen(UDP_NAT_T_IP_SIGNATURE_IN_KEEP_ALIVE) + sizeof(udp_accel->MyIpNatT.address)));
|
||||
required_size += StrLen(UDP_NAT_T_IP_SIGNATURE_IN_KEEP_ALIVE) + sizeof(udp_accel->MyIpNatT.address);
|
||||
|
||||
insert_natt_ip = true;
|
||||
}
|
||||
|
||||
size = MAX(size, required_size);
|
||||
|
||||
}
|
||||
|
||||
buf = MallocFast(size);
|
||||
|
Loading…
Reference in New Issue
Block a user