applied fix from wireshark

master
Serge A. Zaitsev 9 years ago
parent d0664f9a2e
commit 824d9a769c

@ -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)) {

Loading…
Cancel
Save