diff options
author | Serge A. Zaitsev <devnull@localhost> | 2012-02-02 14:05:47 +0200 |
---|---|---|
committer | Serge A. Zaitsev <devnull@localhost> | 2012-02-02 14:05:47 +0200 |
commit | af04595fe243554ee762f515c088f99ce26e2b27 (patch) | |
tree | b8a42df2fe0509d67a7efaf428a2005a54e208b6 /jsmn.c | |
parent | f3b41ae30c7627f540ee539aed51bcca06d23a82 (diff) |
fix: error is returned if brackets are unmatched
Diffstat (limited to 'jsmn.c')
-rw-r--r-- | jsmn.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -161,6 +161,8 @@ jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, jsmntok_t *tokens, break; } } + /* Error if unmatched closing bracket */ + if (i == -1) return JSMN_ERROR_INVAL; for (; i >= 0; i--) { token = &tokens[i]; if (token->start != -1 && token->end == -1) { |