diff --git a/cJSON_Utils.c b/cJSON_Utils.c index 8fa24f8e..5996e13f 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -371,18 +371,23 @@ static void decode_pointer_inplace(unsigned char *string) if (string[1] == '0') { decoded_string[0] = '~'; + string++; } else if (string[1] == '1') { - decoded_string[1] = '/'; + decoded_string[0] = '/'; + string++; } else { /* invalid escape sequence */ + *decoded_string = '\0'; return; } - - string++; + } + else + { + decoded_string[0] = string[0]; } }