From 824d9a769c38584c5aef9f6f12642645c66dc055 Mon Sep 17 00:00:00 2001 From: "Serge A. Zaitsev" Date: Sat, 17 Oct 2015 15:09:35 +0200 Subject: [PATCH] applied fix from wireshark --- jsmn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsmn.c b/jsmn.c index 0e3ad74..74a62d0 100644 --- a/jsmn.c +++ b/jsmn.c @@ -240,7 +240,7 @@ int jsmn_parse(jsmn_parser *parser, const char *js, size_t len, parser->toksuper = parser->toknext - 1; break; case ',': - if (tokens != NULL && + if (tokens != NULL && parser->toksuper != -1 && tokens[parser->toksuper].type != JSMN_ARRAY && tokens[parser->toksuper].type != JSMN_OBJECT) { #ifdef JSMN_PARENT_LINKS @@ -263,7 +263,7 @@ int jsmn_parse(jsmn_parser *parser, const char *js, size_t len, case '5': case '6': case '7' : case '8': case '9': case 't': case 'f': case 'n' : /* And they must not be keys of the object */ - if (tokens != NULL) { + if (tokens != NULL && parser->toksuper != -1) { jsmntok_t *t = &tokens[parser->toksuper]; if (t->type == JSMN_OBJECT || (t->type == JSMN_STRING && t->size != 0)) {