From: Christian Brauner Date: Wed, 1 Apr 2026 21:23:18 +0000 (+0200) Subject: sd-json: fix sd_json_variant_unsigned() dispatching to wrong accessor for references X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F41529%2Fhead;p=thirdparty%2Fsystemd.git sd-json: fix sd_json_variant_unsigned() dispatching to wrong accessor for references sd_json_variant_unsigned() incorrectly calls sd_json_variant_integer() for reference-type variants instead of recursing to itself. This silently returns 0 for unsigned values in the range INT64_MAX+1 through UINT64_MAX, since sd_json_variant_integer() cannot represent them. The sibling functions sd_json_variant_integer() and sd_json_variant_real() correctly recurse to themselves. Signed-off-by: Christian Brauner (Amutable) --- diff --git a/src/libsystemd/sd-json/sd-json.c b/src/libsystemd/sd-json/sd-json.c index 03557d3ac68..6245d471b7a 100644 --- a/src/libsystemd/sd-json/sd-json.c +++ b/src/libsystemd/sd-json/sd-json.c @@ -1003,7 +1003,7 @@ _public_ uint64_t sd_json_variant_unsigned(sd_json_variant *v) { if (!json_variant_is_regular(v)) goto mismatch; if (v->is_reference) - return sd_json_variant_integer(v->reference); + return sd_json_variant_unsigned(v->reference); switch (v->type) {