From d3617d45b787a4856359740717bb6936c98a241a Mon Sep 17 00:00:00 2001 From: "Kavanagh, Mark B" Date: Mon, 26 Feb 2018 16:12:26 +0000 Subject: [PATCH] utils_ovs: fix potential NULL-string dereference In ovs_utils_get_map_value(), a potential NULL-string, returned by YAJL_GET_STRING(), is passed to strcmp, and subsequently dereferenced. Ensure that said string is non-NULL. Fixes: cb59d85 ("ovs_events: Fix plugin collectd config file") 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 a081fa95..650a64c7 100644 --- a/src/utils_ovs.c +++ b/src/utils_ovs.c @@ -1387,7 +1387,7 @@ yajl_val ovs_utils_get_map_value(yajl_val jval, const char *key) { /* return map value if given key equals map key */ str_val = YAJL_GET_STRING(array_values[0]); - if (strcmp(key, str_val) == 0) + if (str_val != NULL && strcmp(key, str_val) == 0) return array_values[1]; } return NULL; -- 2.11.0