diff mbox

[ovs-dev,28/40] datapath-windows: Fix possible NULL deference in OvsFullCopyNBL

Message ID 20170714044033.15196-29-aserdean@cloudbasesolutions.com
State Accepted
Headers show

Commit Message

Alin Serdean July 14, 2017, 4:40 a.m. UTC
Check if the first net buffer exists before trying to copy it.

Found using WDK 10 static code analysis.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
---
 datapath-windows/ovsext/BufferMgmt.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/datapath-windows/ovsext/BufferMgmt.c b/datapath-windows/ovsext/BufferMgmt.c
index c81ca2a..d913380 100644
--- a/datapath-windows/ovsext/BufferMgmt.c
+++ b/datapath-windows/ovsext/BufferMgmt.c
@@ -985,6 +985,9 @@  OvsFullCopyNBL(PVOID ovsContext,
     }
 
     nb = NET_BUFFER_LIST_FIRST_NB(nbl);
+    if (nb == NULL) {
+        return NULL;
+    }
 
     if (NET_BUFFER_NEXT_NB(nb) == NULL) {
         return OvsCopySinglePacketNBL(context, nbl, nb, headRoom, copyNblInfo);