From 6dd02df262844f5c906b76429219a7f681ba2c85 Mon Sep 17 00:00:00 2001 From: miaosu Date: Wed, 9 Aug 2023 20:33:03 +0800 Subject: [PATCH] fix invalid memory access in parse_string --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index f6dd11c..8f44a50 100644 --- a/cJSON.c +++ b/cJSON.c @@ -778,7 +778,7 @@ static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_bu unsigned char *output = NULL; /* not a string */ - if (buffer_at_offset(input_buffer)[0] != '\"') + if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != '\"') { goto fail; }