Check json_object_set_new arguments

A segfault was caused by NULL key.
This commit is contained in:
Petri Lehtinen 2009-10-10 22:53:36 +03:00
parent 8de850be95
commit 9d648a87cb

View File

@ -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;