From 1af74c8cc1cc59c7afbc441f3119378f3c7712d0 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Wed, 28 Jun 2017 15:58:58 +0200 Subject: [PATCH] handle null pointer: get_item_from_pointer --- cJSON_Utils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cJSON_Utils.c b/cJSON_Utils.c index 01cad63..bcdbb64 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -262,6 +262,12 @@ static cJSON_bool decode_array_index_from_pointer(const unsigned char * const po static cJSON *get_item_from_pointer(cJSON * const object, const char * pointer, const cJSON_bool case_sensitive) { cJSON *current_element = object; + + if (pointer == NULL) + { + return NULL; + } + /* follow path of the pointer */ while ((pointer[0] == '/') && (current_element != NULL)) {