linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix possible invalid memory access
       [not found] <CGME20180518035824epcas2p356c2382c482a8fcdd0598816d4dee070@epcas2p3.samsung.com>
@ 2018-05-18  3:58 ` Nagaraj D R
  2018-05-21  8:37   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Nagaraj D R @ 2018-05-18  3:58 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Syam Sidhardhan, Nagaraj D R

Uninitialized data is read from local variable 'addr'
---
 client/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/client/main.c b/client/main.c
index 54bd537..73e77c4 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1774,12 +1774,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]);
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix possible invalid memory access
  2018-05-18  3:58 ` [PATCH] Fix possible invalid memory access Nagaraj D R
@ 2018-05-21  8:37   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2018-05-21  8:37 UTC (permalink / raw)
  To: Nagaraj D R; +Cc: linux-bluetooth@vger.kernel.org, Syam Sidhardhan

Hi,

On Fri, May 18, 2018 at 6:58 AM, Nagaraj D R <nagaraj.dr@samsung.com> wrote:
> Uninitialized data is read from local variable 'addr'
> ---
>  client/main.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/client/main.c b/client/main.c
> index 54bd537..73e77c4 100644
> --- a/client/main.c
> +++ b/client/main.c
> @@ -1774,12 +1774,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]);
>  }
> --
> 1.9.1

Applied, notice that I did some changes so all commands using
find_device shall use proxy_address when printing the address.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-21  8:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20180518035824epcas2p356c2382c482a8fcdd0598816d4dee070@epcas2p3.samsung.com>
2018-05-18  3:58 ` [PATCH] Fix possible invalid memory access Nagaraj D R
2018-05-21  8:37   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).