dbus: a couple of corrections after static analysis
[platform/upstream/dbus.git] / dbus / dbus-transport-kdbus.c
index 0683db5..e8b333a 100755 (executable)
@@ -890,14 +890,16 @@ kdbus_write_msg_internal (DBusTransportKdbus  *transport,
         {
           while (body_size > 0)
             {
-              dbus_uint64_t part_size = body_size;
+              dbus_uint32_t part_size;
 
-              if (part_size > KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE)
-                  part_size = KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE;
+              if (body_size < KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE)
+                part_size = body_size;
+              else
+                part_size = KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE;
 
               /* we need to adjust part size if footer does not fit as a whole */
               if (body_size - part_size > 0 && footer_ptr < (body_data + part_size))
-                  part_size = (dbus_uint64_t)(footer_ptr - body_data);
+                  part_size = footer_ptr - body_data;
 
               _dbus_verbose ("attaching body part\n");
               item = _kdbus_item_add_payload_vec (item,
@@ -2461,7 +2463,8 @@ capture_org_freedesktop_DBus (DBusTransportKdbus *transport,
   int ret = 1;
   if (!strcmp (destination, DBUS_SERVICE_DBUS))
     {
-      if (!strcmp (dbus_message_get_interface (message), DBUS_INTERFACE_DBUS))
+      const char *interface = dbus_message_get_interface (message);
+      if (interface && !strcmp (interface, DBUS_INTERFACE_DBUS))
         {
           DBusError error;
           const char *member = dbus_message_get_member (message);