diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2015-01-31 17:02:30 +0100 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2015-01-31 19:52:02 +0000 |
commit | df468f5f845b68860325bd29ae0e6305f61d03ea (patch) | |
tree | 8bf5158b68f4647184cb81803f849ea58aabc464 /epan | |
parent | dc6482b7c2f4c1157cd490f6c64a62b154d2b53f (diff) |
jsmn: check superior token node value before using it
Other uses are already checked but it looks like those ones were missing
Bug: 10907
Change-Id: I35c160657faba4371fedb96ab822bcd4fffa7dd8
Reviewed-on: https://code.wireshark.org/review/6881
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/jsmn/jsmn.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/epan/jsmn/jsmn.c b/epan/jsmn/jsmn.c index 478e6c457f..acdd2c8b44 100644 --- a/epan/jsmn/jsmn.c +++ b/epan/jsmn/jsmn.c @@ -262,7 +262,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 @@ -285,7 +285,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)) { |