]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-json: allow sd_json_dispatch() accept NULL pointers and treat them like empty... 38980/head
authorLennart Poettering <lennart@poettering.net>
Fri, 29 Aug 2025 13:17:56 +0000 (15:17 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Sep 2025 07:15:05 +0000 (09:15 +0200)
src/libsystemd/sd-json/sd-json.c

index 182a85ae7ff93217c155f7e11c9186ce485d3a4e..77f7524d2a1317785e40ae928b323c3decbf0a7f 100644 (file)
@@ -5096,6 +5096,10 @@ _public_ int sd_json_dispatch_full(
         int r, done = 0;
         bool *found;
 
+        /* Consider a NULL pointer equivalent to an empty object */
+        if (!v)
+                v = JSON_VARIANT_MAGIC_EMPTY_OBJECT;
+
         if (!sd_json_variant_is_object(v)) {
                 json_log(v, flags, 0, "JSON variant is not an object.");