[TCPIP] Add NULL checks in DispTdiQueryInformation. CORE-12274

Add additional NULL checks to DispTdiQueryInformation,
which return STATUS_INVALID_PARAMETER.

Co-authored-by: Peter Hater <7element@mail.bg>
This commit is contained in:
Thomas Brogan 2020-07-28 00:08:00 +03:00 committed by Thomas Faber
parent bb8cb671b8
commit 2e1aeb12df
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -711,6 +711,12 @@ NTSTATUS DispTdiQueryInformation(
switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
case TDI_TRANSPORT_ADDRESS_FILE:
AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle;
if (AddrFile == NULL)
{
TI_DbgPrint(MIN_TRACE, ("FIXME: No address file object.\n"));
ASSERT(AddrFile != NULL);
return STATUS_INVALID_PARAMETER;
}
Address->TAAddressCount = 1;
Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
@ -725,6 +731,12 @@ NTSTATUS DispTdiQueryInformation(
case TDI_CONNECTION_FILE:
Endpoint =
(PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
if (Endpoint == NULL || Endpoint->AddressFile == NULL)
{
TI_DbgPrint(MIN_TRACE, ("FIXME: No connection endpoint file object.\n"));
ASSERT(Endpoint != NULL && Endpoint->AddressFile != NULL);
return STATUS_INVALID_PARAMETER;
}
Address->TAAddressCount = 1;
Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;