Fix possible invalid memory access 06/179406/1
authorNagaraj D R <nagaraj.dr@samsung.com>
Thu, 17 May 2018 15:03:36 +0000 (20:33 +0530)
committerNagaraj D R <nagaraj.dr@samsung.com>
Thu, 17 May 2018 15:06:37 +0000 (20:36 +0530)
Uninitialized data is read from local variable 'addr'

Change-Id: Id8288428e93a8dda08d67a507fd97caf5fae080e

client/main.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 76842b1..17a92fd
@@ -1818,12 +1818,12 @@ static void cmd_disconn(int argc, char *argv[])
 
        if (argc < 2 || strlen(argv[1]) == 0) {
                DBusMessageIter iter;
-               const char *addr;
 
-               if (g_dbus_proxy_get_property(proxy, "Address", &iter) == TRUE)
+               if (g_dbus_proxy_get_property(proxy, "Address", &iter) == TRUE) {
+                       const char *addr;
                        dbus_message_iter_get_basic(&iter, &addr);
-
-               bt_shell_printf("Attempting to disconnect from %s\n", addr);
+                       bt_shell_printf("Attempting to disconnect from %s\n", addr);
+               }
        } else
                bt_shell_printf("Attempting to disconnect from %s\n", argv[1]);
 }