public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] client: add input validation to main()
@ 2025-03-03 14:48 Roman Smirnov
  2025-03-03 16:12 ` [BlueZ,v2] " bluez.test.bot
  2025-03-03 17:50 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2025-03-03 14:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

An error was found during fuzzing testing. When passing Unicode
characters 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/1118
---
 client/main.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/client/main.c b/client/main.c
index feb21a116..6b938da3f 100644
--- a/client/main.c
+++ b/client/main.c
@@ -843,6 +843,18 @@ static gboolean parse_argument(int argc, char *argv[], const char **arg_table,
 	return FALSE;
 }
 
+static int validate_input(int argc, char *argv[])
+{
+	for (int i = 0; i < argc; i++) {
+		if (!strisutf8(argv[i], strlen(argv[i]))) {
+			printf("Invalid character in string: %s\n", argv[i]);
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
 static void cmd_list(int argc, char *argv[])
 {
 	GList *list;
@@ -3299,6 +3311,10 @@ int main(int argc, char *argv[])
 	int timeout;
 	unsigned int timeout_id;
 
+	status = validate_input(argc, argv);
+	if (status)
+		return status;
+
 	bt_shell_init(argc, argv, &opt);
 	bt_shell_set_menu(&main_menu);
 	bt_shell_add_submenu(&advertise_menu);
-- 
2.43.0


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

* RE: [BlueZ,v2] client: add input validation to main()
  2025-03-03 14:48 [PATCH BlueZ v2] client: add input validation to main() Roman Smirnov
@ 2025-03-03 16:12 ` bluez.test.bot
  2025-03-03 17:50 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-03-03 16:12 UTC (permalink / raw)
  To: linux-bluetooth, r.smirnov

[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=939649

---Test result---

Test Summary:
CheckPatch                    PENDING   0.24 seconds
GitLint                       PENDING   0.23 seconds
BuildEll                      PASS      20.40 seconds
BluezMake                     PASS      1500.02 seconds
MakeCheck                     PASS      13.06 seconds
MakeDistcheck                 PASS      160.76 seconds
CheckValgrind                 PASS      215.10 seconds
CheckSmatch                   PASS      283.51 seconds
bluezmakeextell               PASS      98.61 seconds
IncrementalBuild              PENDING   0.27 seconds
ScanBuild                     PASS      874.53 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ v2] client: add input validation to main()
  2025-03-03 14:48 [PATCH BlueZ v2] client: add input validation to main() Roman Smirnov
  2025-03-03 16:12 ` [BlueZ,v2] " bluez.test.bot
@ 2025-03-03 17:50 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-03-03 17:50 UTC (permalink / raw)
  To: Roman Smirnov; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 3 Mar 2025 17:48:43 +0300 you wrote:
> An error was found during fuzzing testing. When passing Unicode
> characters 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.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v2] client: add input validation to main()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8479c279ea93

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-03 14:48 [PATCH BlueZ v2] client: add input validation to main() Roman Smirnov
2025-03-03 16:12 ` [BlueZ,v2] " bluez.test.bot
2025-03-03 17:50 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth

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