From: Kavanagh, Mark B Date: Mon, 26 Feb 2018 17:08:31 +0000 (+0000) Subject: utils_ovs: fix potential NULL X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=7858bf59eeed7b8769dd7258af7ea223e37287e4 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 --- 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