diff --git a/json_object.c b/json_object.c index d59a317..1e4f86d 100644 --- a/json_object.c +++ b/json_object.c @@ -180,8 +180,9 @@ static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int { size_t pos = 0, start_offset = 0; unsigned char c; - while (len--) + while (len) { + --len; c = str[pos]; switch (c) {