diff mbox

[ovs-dev,10/40] datapath-windows: Fix possible NULL deference

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

Commit Message

Alin Serdean July 14, 2017, 4:40 a.m. UTC
`ethHdr` may be NULL while trying to push mpls lables.

Found with WDK 10 static code analysis.

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

Patch

diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c
index ebe8264..39539e0 100644
--- a/datapath-windows/ovsext/Actions.c
+++ b/datapath-windows/ovsext/Actions.c
@@ -1244,6 +1244,10 @@  OvsActionMplsPush(OvsForwardingContext *ovsFwdCtx,
     ASSERT(mdlLen >= MPLS_HLEN);
 
     ethHdr = (EthHdr *)(bufferStart + curMdlOffset);
+    if (!ethHdr) {
+        ovsActionStats.noResource++;
+        return NDIS_STATUS_RESOURCES;
+    }
     RtlMoveMemory(ethHdr, (UINT8*)ethHdr + MPLS_HLEN, sizeof(*ethHdr));
     ethHdr->Type = mpls->mpls_ethertype;