dbus-marshal-gavariant : Update offset bytes size whenever message is appended 70/78270/1
authorJonghwa Lee <jonghwa3.lee@samsung.com>
Tue, 5 Jul 2016 02:18:17 +0000 (11:18 +0900)
committerJonghwa Lee <jonghwa3.lee@samsung.com>
Tue, 5 Jul 2016 03:52:11 +0000 (12:52 +0900)
check_offsets_in_body_for_adding() is called only when former data is not fixed
sized data. If former written data is fixed size one (e.g. integer, boolean..)
it skips to update offset bytes size even message body size exceeds its limits.
It results invalid memory access on reciever-side.

This patch fixes it to update offset bytes size whenever message is appended.

Change-Id: I2b94955d40debc5129b5f3c193e197efb542141b
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
dbus/dbus-marshal-gvariant.c

index a720203..58cf414 100644 (file)
@@ -1173,10 +1173,10 @@ _dbus_writer_gvariant_add_offset_with_variability (DBusTypeWriter *writer,
 
   if (writer->body_container)
   {
+    check_offsets_in_body_for_adding (writer);
+
     if (*writer->u.root.last_offset != 0)
     {
-      check_offsets_in_body_for_adding (writer);
-
       write_offset (writer->value_str,
                     *writer->u.root.last_offset,
                     writer->offsets_size,