From 9d648a87cb13df0308723c3000acc4fe0e955406 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Sat, 10 Oct 2009 22:53:36 +0300 Subject: [PATCH] Check json_object_set_new arguments A segfault was caused by NULL key. --- src/value.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;