diff options
author | Petri Lehtinen <petri@digip.org> | 2009-08-24 20:58:59 +0300 |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2009-08-24 20:58:59 +0300 |
commit | ee2d164025b5090c7cd81ffd8c1e3e07d45e5d31 (patch) | |
tree | 92b67535143428d242ebeb2b4b1f2e4ced383335 /src | |
parent | b3e265eb843328749b5d1a943377992034c49475 (diff) | |
download | jansson-ee2d164025b5090c7cd81ffd8c1e3e07d45e5d31.zip jansson-ee2d164025b5090c7cd81ffd8c1e3e07d45e5d31.tar.gz jansson-ee2d164025b5090c7cd81ffd8c1e3e07d45e5d31.tar.bz2 |
Detect garbage near EOF in json_loadf() and json_load_file()
Diffstat (limited to 'src')
-rw-r--r-- | src/load.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -805,7 +805,17 @@ json_t *json_loadf(FILE *input, json_error_t *error) return NULL; result = parse_json(&lex, error); + if(!result) + goto out; + + lex_scan(&lex, error); + if(lex.token != TOKEN_EOF) { + error_set(error, &lex, "end of file expected"); + json_decref(result); + result = NULL; + } +out: lex_close(&lex); return result; } |