[ovs-dev] [PATCH] nx-match: Avoid null pointer dereference in nx_pull_header__() error case.

Ben Pfaff blp at nicira.com
Thu Apr 16 21:04:47 UTC 2015


Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo at FreeBSD.org>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/nx-match.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/nx-match.c b/lib/nx-match.c
index 4b72460..21f291c 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -319,7 +319,9 @@ bad_len:
                 b->size);
 error:
     *header = 0;
-    *field = NULL;
+    if (field) {
+        *field = NULL;
+    }
     return OFPERR_OFPBMC_BAD_LEN;
 }
 
-- 
2.1.3




More information about the dev mailing list