diff options
author | Petri Lehtinen <petri@digip.org> | 2009-10-10 22:53:36 +0300 |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2009-10-10 22:53:36 +0300 |
commit | 9d648a87cb13df0308723c3000acc4fe0e955406 (patch) | |
tree | 759259c627b2b51986d65d8b3948735f3000510b | |
parent | 8de850be95342d1cfbc1133f0ab95cc1d4c99a25 (diff) | |
download | jansson-9d648a87cb13df0308723c3000acc4fe0e955406.zip jansson-9d648a87cb13df0308723c3000acc4fe0e955406.tar.gz jansson-9d648a87cb13df0308723c3000acc4fe0e955406.tar.bz2 |
Check json_object_set_new arguments
A segfault was caused by NULL key.
-rw-r--r-- | src/value.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/value.c b/src/value.c index bf5fd54..d8e9e9a 100644 --- a/src/value.c +++ b/src/value.c @@ -148,7 +148,7 @@ int json_object_set_nocheck(json_t *json, const char *key, json_t *value) int json_object_set_new(json_t *json, const char *key, json_t *value) { - if(!utf8_check_string(key, -1)) + if(!key || !utf8_check_string(key, -1)) { json_decref(value); return -1; |