1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-06 09:40:41 +03:00

Merge pull request #178 from mcsalgado/fix_initialization

Fix set initialization, set.OnlyCapsuleModeIsInvalid could be garbage
This commit is contained in:
Daiyuu Nobori 2016-11-27 17:54:17 +09:00 committed by GitHub
commit 7c30cddedb

View File

@ -4723,11 +4723,11 @@ bool GetBestTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET *pr, IPSEC_SA
if (transform_payload != NULL) if (transform_payload != NULL)
{ {
IKE_PACKET_TRANSFORM_PAYLOAD *transform = &transform_payload->Payload.Transform; IKE_PACKET_TRANSFORM_PAYLOAD *transform = &transform_payload->Payload.Transform;
IPSEC_SA_TRANSFORM_SETTING set; IPSEC_SA_TRANSFORM_SETTING *set = NULL;
if (TransformPayloadToTransformSettingForIPsecSa(ike, transform, &set, server_ip)) if (TransformPayloadToTransformSettingForIPsecSa(ike, transform, set, server_ip))
{ {
Copy(setting, &set, sizeof(IPSEC_SA_TRANSFORM_SETTING)); Copy(setting, set, sizeof(IPSEC_SA_TRANSFORM_SETTING));
setting->SpiServerToClient = READ_UINT(proposal->Spi->Buf); setting->SpiServerToClient = READ_UINT(proposal->Spi->Buf);
@ -4735,11 +4735,11 @@ bool GetBestTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET *pr, IPSEC_SA
} }
else else
{ {
if (set.OnlyCapsuleModeIsInvalid) if (set != NULL && set->OnlyCapsuleModeIsInvalid)
{ {
if (ocmii_flag == false) if (ocmii_flag == false)
{ {
Copy(setting, &set, sizeof(IPSEC_SA_TRANSFORM_SETTING)); Copy(setting, set, sizeof(IPSEC_SA_TRANSFORM_SETTING));
ocmii_flag = true; ocmii_flag = true;
} }
} }