diff options
author | Serge A. Zaitsev <zaitsev.serge@gmail.com> | 2015-10-17 15:09:35 +0200 |
---|---|---|
committer | Serge A. Zaitsev <zaitsev.serge@gmail.com> | 2015-10-17 15:09:35 +0200 |
commit | 824d9a769c38584c5aef9f6f12642645c66dc055 (patch) | |
tree | 1a9c00fb4955406d496827ee797b08401628a94a /jsmn.c | |
parent | d0664f9a2ee942e0edaa255309f67b3f77e04b50 (diff) |
applied fix from wireshark
Diffstat (limited to 'jsmn.c')
-rw-r--r-- | jsmn.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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)) { |