https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f76a097a252b52154bdc0…
commit f76a097a252b52154bdc0818a897200e99e2bc29
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Tue Jan 1 10:45:48 2019 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Tue Jan 1 10:45:48 2019 +0100
[TCPIP] Check buffer before dereferencing it
CID 716664
---
drivers/network/tcpip/tcpip/ninfo.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/network/tcpip/tcpip/ninfo.c b/drivers/network/tcpip/tcpip/ninfo.c
index cb88a2110d..5c0952b033 100644
--- a/drivers/network/tcpip/tcpip/ninfo.c
+++ b/drivers/network/tcpip/tcpip/ninfo.c
@@ -312,13 +312,13 @@ TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF, PVOID Buffer, UINT
BufferSize)
IP_ADDRESS Address, Netmask, Router;
PIPROUTE_ENTRY Route = Buffer;
+ if (!Buffer || BufferSize < sizeof(IPROUTE_ENTRY))
+ return TDI_INVALID_PARAMETER;
+
AddrInitIPv4( &Address, Route->Dest );
AddrInitIPv4( &Netmask, Route->Mask );
AddrInitIPv4( &Router, Route->Gw );
- if (!Buffer || BufferSize < sizeof(IPROUTE_ENTRY))
- return TDI_INVALID_PARAMETER;
-
if (IF == Loopback)
{
DbgPrint("Failing attempt to add route to loopback adapter\n");