From 306465322f63f474fd2c225345a88a26a7206998 Mon Sep 17 00:00:00 2001 From: SummerSolsticeMuch Date: Fri, 3 Apr 2026 16:17:42 +0800 Subject: [PATCH] fix: correct ~1 decode in decode_pointer_inplace() The ~1 escape sequence (RFC 6901 Section 4) should decode to '/'. The ~0 case correctly writes to decoded_string[0], but the ~1 case writes to decoded_string[1] instead of decoded_string[0]. This is a copy-paste bug from the ~0 case where only the character was changed but the index was also accidentally changed. This causes all JSON Pointer and JSON Patch operations on keys containing '/' to silently fail or target the wrong key. --- cJSON_Utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON_Utils.c b/cJSON_Utils.c index 8fa24f8e..3b642fa1 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -374,7 +374,7 @@ static void decode_pointer_inplace(unsigned char *string) } else if (string[1] == '1') { - decoded_string[1] = '/'; + decoded_string[0] = '/'; } else {