[ros-diffs] [cgutman] 36524: - Fail if From is NULL - Fixes Coverity error 652

cgutman at svn.reactos.org cgutman at svn.reactos.org
Fri Sep 26 05:03:56 CEST 2008


Author: cgutman
Date: Thu Sep 25 22:03:55 2008
New Revision: 36524

URL: http://svn.reactos.org/svn/reactos?rev=36524&view=rev
Log:
 - Fail if From is NULL
 - Fixes Coverity error 652

Modified:
    branches/aicom-network-fixes/drivers/network/afd/afd/tdiconn.c

Modified: branches/aicom-network-fixes/drivers/network/afd/afd/tdiconn.c
URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/network/afd/afd/tdiconn.c?rev=36524&r1=36523&r2=36524&view=diff
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/tdiconn.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/tdiconn.c [iso-8859-1] Thu Sep 25 22:03:55 2008
@@ -194,6 +194,8 @@
     ULONG TdiAddressSize;
     PTDI_CONNECTION_INFORMATION FromTdiConn, ToTdiConn;
 
+    if (!From) return STATUS_INVALID_PARAMETER;
+
     /* FIXME: Get from socket information */
     TdiAddressSize = TdiAddressSizeFromType(From->Address[0].AddressType);
     SizeOfEntry = TdiAddressSize + sizeof(TDI_CONNECTION_INFORMATION);
@@ -207,15 +209,10 @@
 
     RtlZeroMemory( LayoutFrame, 2 * SizeOfEntry );
 
-	FromTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame;
-	ToTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame + SizeOfEntry;
-
-    if (From != NULL) {
-	TdiBuildConnectionInfoInPlace( FromTdiConn, From );
-    } else {
-	TdiBuildNullConnectionInfoInPlace( FromTdiConn,
-					   From->Address[0].AddressType );
-    }
+    FromTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame;
+    ToTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame + SizeOfEntry;
+
+    TdiBuildConnectionInfoInPlace( FromTdiConn, From );
 
     TdiBuildConnectionInfoInPlace( ToTdiConn, To );
 



More information about the Ros-diffs mailing list