diff --git a/cJSON.c b/cJSON.c index 766e558ef06d4e97525a85f937aae4709f26d808..ded3c8802c10a287fc5807b4d1a888c6c9a817fe 100644 --- a/cJSON.c +++ b/cJSON.c @@ -712,8 +712,9 @@ static char *print_string_ptr(const char *str, printbuffer *p) ptr = str; /* calculate additional space that is needed for escaping */ - while ((token = *ptr) && ++len) + while ((token = *ptr)) { + ++len; if (strchr("\"\\\b\f\n\r\t", token)) { len++; /* +1 for the backslash */