[ovs-dev] [PATCH 10/40] datapath-windows: Fix possible NULL deference
Alin Serdean
aserdean at cloudbasesolutions.com
Fri Jul 14 04:40:53 UTC 2017
`ethHdr` may be NULL while trying to push mpls lables.
Found with WDK 10 static code analysis.
Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
---
datapath-windows/ovsext/Actions.c | 4 ++++
1 file changed, 4 insertions(+)
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;
--
2.10.2.windows.1
More information about the dev
mailing list