public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2 0/1] shared/shell: Fix SIGSEGV on invalid input
@ 2026-03-19 14:14 Wouter
  2026-03-19 14:14 ` [PATCH BlueZ v2 1/1] " Wouter
  2026-03-19 17:50 ` [PATCH BlueZ v2 0/1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 5+ messages in thread
From: Wouter @ 2026-03-19 14:14 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Wouter

I have updated the patch according to feedback received earlier today.
The valgrind input has been attached as a commit message, and checks are
now applied further down the callstack rather than at the source.

--

In `bluetoothctl` when entering a space followed by a tab the CLI
crashes with a segfault. This patch fixes the user input handling.

Wouter (1):
  shared/shell: Fix SIGSEGV on invalid input

 src/shared/shell.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH BlueZ 1/1] shared/shell: Fix SIGSEGV on invalid input
@ 2026-03-19  2:16 Wouter
  2026-03-19  4:24 ` bluez.test.bot
  0 siblings, 1 reply; 5+ messages in thread
From: Wouter @ 2026-03-19  2:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Wouter

This fixes a crash when handling "<space><tab>"
---
 src/shared/shell.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index b061f8001..57bba0977 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1174,15 +1174,17 @@ static char **shell_completion(const char *text, int start, int end)
 		if (wordexp(rl_line_buffer, &w, WRDE_NOCMD))
 			return NULL;
 
-		matches = menu_completion(default_menu.entries, text,
-						w.we_wordc, w.we_wordv[0]);
-		if (!matches) {
-			matches = menu_completion(data.menu->entries, text,
-							w.we_wordc,
-							w.we_wordv[0]);
-			if (!matches)
-				matches = submenu_completion(text, w.we_wordc,
+		if (w.we_wordc != 0) {
+			matches = menu_completion(default_menu.entries, text,
+							w.we_wordc, w.we_wordv[0]);
+			if (!matches) {
+				matches = menu_completion(data.menu->entries, text,
+								w.we_wordc,
 								w.we_wordv[0]);
+				if (!matches)
+					matches = submenu_completion(text, w.we_wordc,
+									w.we_wordv[0]);
+			}
 		}
 
 		wordfree(&w);
-- 
2.53.0


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

end of thread, other threads:[~2026-03-19 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 14:14 [PATCH BlueZ v2 0/1] shared/shell: Fix SIGSEGV on invalid input Wouter
2026-03-19 14:14 ` [PATCH BlueZ v2 1/1] " Wouter
2026-03-19 15:54   ` bluez.test.bot
2026-03-19 17:50 ` [PATCH BlueZ v2 0/1] " patchwork-bot+bluetooth
  -- strict thread matches above, loose matches on Subject: below --
2026-03-19  2:16 [PATCH BlueZ 1/1] " Wouter
2026-03-19  4:24 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox