mirror of
https://github.com/reactos/reactos.git
synced 2025-07-13 19:24:13 +00:00
[TCPIP] Check for allocation failures in ReadIpConfiguration. CID 1411924
This commit is contained in:
parent
63a3a2cbb8
commit
d87786bf6c
1 changed files with 36 additions and 30 deletions
|
@ -638,14 +638,16 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
|
||||||
{
|
{
|
||||||
RegistryDataU.Length = KeyValueInfo->DataLength;
|
RegistryDataU.Length = KeyValueInfo->DataLength;
|
||||||
|
|
||||||
RtlUnicodeStringToAnsiString(&RegistryDataA,
|
Status = RtlUnicodeStringToAnsiString(&RegistryDataA,
|
||||||
&RegistryDataU,
|
&RegistryDataU,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
AddrInitIPv4(&Interface->Unicast, inet_addr(RegistryDataA.Buffer));
|
{
|
||||||
|
AddrInitIPv4(&Interface->Unicast,
|
||||||
|
inet_addr(RegistryDataA.Buffer));
|
||||||
RtlFreeAnsiString(&RegistryDataA);
|
RtlFreeAnsiString(&RegistryDataA);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Status = ZwQueryValueKey(ParameterHandle,
|
Status = ZwQueryValueKey(ParameterHandle,
|
||||||
&Netmask,
|
&Netmask,
|
||||||
|
@ -657,14 +659,16 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
|
||||||
{
|
{
|
||||||
RegistryDataU.Length = KeyValueInfo->DataLength;
|
RegistryDataU.Length = KeyValueInfo->DataLength;
|
||||||
|
|
||||||
RtlUnicodeStringToAnsiString(&RegistryDataA,
|
Status = RtlUnicodeStringToAnsiString(&RegistryDataA,
|
||||||
&RegistryDataU,
|
&RegistryDataU,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
AddrInitIPv4(&Interface->Netmask, inet_addr(RegistryDataA.Buffer));
|
{
|
||||||
|
AddrInitIPv4(&Interface->Netmask,
|
||||||
|
inet_addr(RegistryDataA.Buffer));
|
||||||
RtlFreeAnsiString(&RegistryDataA);
|
RtlFreeAnsiString(&RegistryDataA);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We have to wait until both IP address and subnet mask
|
/* We have to wait until both IP address and subnet mask
|
||||||
* are read to add the interface route, but we must do it
|
* 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;
|
RegistryDataU.Length = KeyValueInfo->DataLength;
|
||||||
|
|
||||||
RtlUnicodeStringToAnsiString(&RegistryDataA,
|
Status = RtlUnicodeStringToAnsiString(&RegistryDataA,
|
||||||
&RegistryDataU,
|
&RegistryDataU,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
AddrInitIPv4(&Router, inet_addr(RegistryDataA.Buffer));
|
AddrInitIPv4(&Router, inet_addr(RegistryDataA.Buffer));
|
||||||
|
|
||||||
if (!AddrIsUnspecified(&Router))
|
if (!AddrIsUnspecified(&Router))
|
||||||
|
@ -696,6 +701,7 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
|
||||||
RtlFreeAnsiString(&RegistryDataA);
|
RtlFreeAnsiString(&RegistryDataA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExFreePoolWithTag(KeyValueInfo, KEY_VALUE_TAG);
|
ExFreePoolWithTag(KeyValueInfo, KEY_VALUE_TAG);
|
||||||
ZwClose(ParameterHandle);
|
ZwClose(ParameterHandle);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue