[PATCH BlueZ v1] client: Fix crashing command info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

If command info is called without any parameters, and without connecting
any device, it will call find_set which doesn't check argc and argv are
actually valid.

Fixes: https://github.com/bluez/bluez/issues/1251
---
 client/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/client/main.c b/client/main.c
index 36a7446d52c1..5d53a7be11e4 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1641,6 +1641,9 @@ static struct GDBusProxy *find_set(int argc, char *argv[])
 	if (check_default_ctrl() == FALSE)
 		return NULL;
 
+	if (argc < 2 || !strlen(argv[1]))
+		return NULL;
+
 	proxy = find_proxies_by_path(default_ctrl->sets, argv[1]);
 	if (!proxy) {
 		bt_shell_printf("DeviceSet %s not available\n", argv[1]);
-- 
2.49.0





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux