[TCPIP] Check for allocation failures in ReadIpConfiguration. CID 1411924

This commit is contained in:
Thomas Faber 2018-01-08 13:51:04 +01:00
parent 63a3a2cbb8
commit d87786bf6c
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -638,14 +638,16 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
{
RegistryDataU.Length = KeyValueInfo->DataLength;
RtlUnicodeStringToAnsiString(&RegistryDataA,
Status = RtlUnicodeStringToAnsiString(&RegistryDataA,
&RegistryDataU,
TRUE);
AddrInitIPv4(&Interface->Unicast, inet_addr(RegistryDataA.Buffer));
if (NT_SUCCESS(Status))
{
AddrInitIPv4(&Interface->Unicast,
inet_addr(RegistryDataA.Buffer));
RtlFreeAnsiString(&RegistryDataA);
}
}
Status = ZwQueryValueKey(ParameterHandle,
&Netmask,
@ -657,14 +659,16 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
{
RegistryDataU.Length = KeyValueInfo->DataLength;
RtlUnicodeStringToAnsiString(&RegistryDataA,
Status = RtlUnicodeStringToAnsiString(&RegistryDataA,
&RegistryDataU,
TRUE);
AddrInitIPv4(&Interface->Netmask, inet_addr(RegistryDataA.Buffer));
if (NT_SUCCESS(Status))
{
AddrInitIPv4(&Interface->Netmask,
inet_addr(RegistryDataA.Buffer));
RtlFreeAnsiString(&RegistryDataA);
}
}
/* We have to wait until both IP address and subnet mask
* are read to add the interface route, but we must do it
@ -684,10 +688,11 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
{
RegistryDataU.Length = KeyValueInfo->DataLength;
RtlUnicodeStringToAnsiString(&RegistryDataA,
Status = RtlUnicodeStringToAnsiString(&RegistryDataA,
&RegistryDataU,
TRUE);
if (NT_SUCCESS(Status))
{
AddrInitIPv4(&Router, inet_addr(RegistryDataA.Buffer));
if (!AddrIsUnspecified(&Router))
@ -696,6 +701,7 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
RtlFreeAnsiString(&RegistryDataA);
}
}
}
ExFreePoolWithTag(KeyValueInfo, KEY_VALUE_TAG);
ZwClose(ParameterHandle);