Closed mbeynon closed 1 month ago
Well, I do not think this is a bug.
Please notice there is a input_pointer++
in the for
loop here :
https://github.com/DaveGamble/cJSON/blob/master/cJSON.c#L984
for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++)
Which means it will be 4 + 1 = 5 chars.
Ah yes, you are correct. That code only needs to increment output_pointer
for anything beyond the single character that the loop already handles.
My mistake ... sorry for the noise.
The sprintf() call before this uses a format string of "u%04x", which is a
u
followed by 4 hex chars. This means it always prints 5 chars. The increment on this line only increments by 4 instead of 5, which seems to be a bug by inspection.https://github.com/DaveGamble/cJSON/blob/324973008ced4ea03d1626a00915d0399ecbd9db/cJSON.c#L1021
Thank you