kdbus: Add a null teminated string for GetConnectionCredentials (LinuxSecurityLabel... 71/88071/1 accepted/tizen/common/20160919.154456 accepted/tizen/ivi/20160920.051618 accepted/tizen/mobile/20160920.051523 accepted/tizen/tv/20160920.051536 accepted/tizen/wearable/20160920.051558 submit/tizen/20160919.053144
authorINSUN PYO <insun.pyo@samsung.com>
Tue, 13 Sep 2016 07:42:45 +0000 (16:42 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Tue, 13 Sep 2016 07:43:44 +0000 (16:43 +0900)
The result of LinuxSecurityLabel item should end to null.
Dbus spec : https://dbus.freedesktop.org/doc/dbus-specification.html

Legacy dbus daemon : dbus/bus/driver.c. _dbus_asv_add_byte_array (&array_iter, "LinuxSecurityLabel", s, strlen (s) + 1))
libdbus kdbus : dbus-transport-kdbus.c. dbus_bool_t res = _dbus_asv_add_byte_array (&array_iter, "LinuxSecurityLabel", info.sec_label, strlen (info.sec_label)+1);

Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Idff013ca4c56d93a6207bcb7365b36da86f7c1c2

gio/gkdbusfakedaemon.c

index ace30e6..a6d8135 100644 (file)
@@ -261,7 +261,7 @@ _dbus_daemon_synthetic_reply (GKDBusWorker  *worker,
 
                   label_size = strlen (creds->sec_label);
                   label_builder = g_variant_builder_new (G_VARIANT_TYPE ("ay"));
-                  for (counter = 0 ; counter < label_size ; counter++)
+                  for (counter = 0 ; counter < label_size + 1; counter++)   /* label_size + 1 : include the \0 in the payload, for zero-copy reading. From dbus/bus/driver.c */
                     g_variant_builder_add (label_builder, "y", creds->sec_label[counter]);
 
                   g_variant_builder_add (&builder, "{sv}", "LinuxSecurityLabel", g_variant_new ("ay", label_builder));