Check that target is string and value is not NULL in json_string_set()
authorPetri Lehtinen <petri@digip.org>
Fri, 17 Jun 2011 18:42:11 +0000 (21:42 +0300)
committerPetri Lehtinen <petri@digip.org>
Fri, 17 Jun 2011 18:42:19 +0000 (21:42 +0300)
src/value.c

index 47ebb2c..d0517d5 100644 (file)
@@ -703,6 +703,9 @@ int json_string_set_nocheck(json_t *json, const char *value)
     char *dup;
     json_string_t *string;
 
+    if(!json_is_string(json) || !value)
+        return -1;
+
     dup = jsonp_strdup(value);
     if(!dup)
         return -1;