bus-message: fix gvariant array elements alignment computing
authorAdrian Szyndela <adrian.s@samsung.com>
Mon, 16 Mar 2020 11:08:04 +0000 (12:08 +0100)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Thu, 25 Jan 2024 12:36:08 +0000 (13:36 +0100)
Commit f88214cf9d66c93f4d22c4c8980de9ee3ff45bab introduced correction
of computing of variable sized elements of arrays. However,
alignment was taken from outer signature instead of type of elements
in the array. For example, for signature "a(sasbttttuii)"
the alignment of elements of the inner array ("as"; should be 1) was computed
from the alignment of "sasbttttuii" (which is 8).

This commit corrects the alignment source.

src/libsystemd/sd-bus/bus-message.c

index b45604b..6bb7129 100644 (file)
@@ -3701,7 +3701,7 @@ static int bus_message_enter_array(
                 if (!*offsets)
                         return -ENOMEM;
 
-                alignment = bus_gvariant_get_alignment(c->signature);
+                alignment = bus_gvariant_get_alignment(contents);
                 assert(alignment > 0);
 
                 for (i = 0; i < *n_offsets; i++) {