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) <brauner@kernel.org>
This commit is contained in:
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user