summaryrefslogtreecommitdiff
path: root/jsmn.c
diff options
context:
space:
mode:
authorSerge A. Zaitsev <zaitsev.serge@gmail.com>2015-10-17 15:09:35 +0200
committerSerge A. Zaitsev <zaitsev.serge@gmail.com>2015-10-17 15:09:35 +0200
commit824d9a769c38584c5aef9f6f12642645c66dc055 (patch)
tree1a9c00fb4955406d496827ee797b08401628a94a /jsmn.c
parentd0664f9a2ee942e0edaa255309f67b3f77e04b50 (diff)
applied fix from wireshark
Diffstat (limited to 'jsmn.c')
-rw-r--r--jsmn.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/jsmn.c b/jsmn.c
index 0e3ad740f..74a62d075 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)) {