diff mbox series

[BlueZ,v1] client: Fix crashing command info

Message ID 20250519142009.2493740-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v1] client: Fix crashing command info | expand

Commit Message

Luiz Augusto von Dentz May 19, 2025, 2:20 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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 mbox series

Patch

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]);