diff mbox series

[BlueZ,3/3] shared/shell: add check to shell_exec()

Message ID 20250318131431.124750-4-r.smirnov@omp.ru (mailing list archive)
State Accepted
Commit 1edffc22a343511ad1357d002f1968e4746c68a6
Headers show
Series Fix crash in dbus caused by Unicode characters | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

Commit Message

Roman Smirnov March 18, 2025, 1:14 p.m. UTC
When passing a Unicode character to bluetoothctl, the application
crashes in dbus:

dbus[5324]: arguments to dbus_message_iter_append_basic() were
incorrect, assertion "_dbus_check_is_valid_utf8 (*string_p)"
failed in file .../dbus-message.c line 2765.

Check that all characters are written in utf8.

Fixes: https://github.com/bluez/bluez/issues/1137
---
 src/shared/shell.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 107fc7a76..b77842177 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -678,6 +678,9 @@  static int shell_exec(int argc, char *argv[])
 	if (!data.menu || !argv[0])
 		return -EINVAL;
 
+	if (!argsisutf8(argc, argv))
+		return -EINVAL;
+
 	err  = menu_exec(default_menu, argc, argv);
 	if (err == -ENOENT) {
 		err  = menu_exec(data.menu->entries, argc, argv);