From 7858bf59eeed7b8769dd7258af7ea223e37287e4 Mon Sep 17 00:00:00 2001 From: "Kavanagh, Mark B" Date: Mon, 26 Feb 2018 17:08:31 +0000 Subject: [PATCH] utils_ovs: fix potential NULL In ovs_utils_get_map_value(), YAJL_GET_ARRAY may return a NULL pointer, which is subsequently dereferenced. Ensure that the pointer is non-NULL before proceeding. Fixes: 12f6497 ("ovs_events: Add external ids as metadata") Signed-off-by: Mark Kavanagh --- src/utils_ovs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils_ovs.c b/src/utils_ovs.c index 650a64c7..f98841cd 100644 --- a/src/utils_ovs.c +++ b/src/utils_ovs.c @@ -1375,7 +1375,7 @@ yajl_val ovs_utils_get_map_value(yajl_val jval, const char *key) { map_values = YAJL_GET_ARRAY(array_values[1])->values; for (size_t i = 0; i < map_len; i++) { /* check YAJL array */ - if (!YAJL_IS_ARRAY(map_values[i])) + if (!YAJL_IS_ARRAY(map_values[i]) || YAJL_GET_ARRAY(map_values[i]) == NULL) break; /* check a database pair value (2-element, first one represents a key -- 2.11.0