diff mbox series

[BlueZ,2/2] core: Report error in case of bt_name2string failure

Message ID 20250302090331.17756-2-arkadiusz.bokowy@gmail.com (mailing list archive)
State Accepted
Commit 32e2e5a42b2b51b7a196de0b5bd199eeb5ce4725
Headers show
Series [BlueZ,1/2] uuid-helper: Accept any 16-bit HEX value as a valid UUID | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

Commit Message

Arkadiusz Bokowy March 2, 2025, 9:03 a.m. UTC
---
 src/device.c  | 4 ++++
 src/profile.c | 2 ++
 2 files changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index ec97fc889..aca28af8c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2646,6 +2646,10 @@  static DBusMessage *connect_profile(DBusConnection *conn, DBusMessage *msg,
 	}
 
 	uuid = bt_name2string(pattern);
+	if (uuid == NULL)
+		return btd_error_invalid_args_str(msg,
+					ERR_BREDR_CONN_INVALID_ARGUMENTS);
+
 	reply = connect_profiles(dev, BDADDR_BREDR, msg, uuid);
 	free(uuid);
 
diff --git a/src/profile.c b/src/profile.c
index 9fdfb7dff..ad2043628 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -2319,6 +2319,8 @@  static int parse_ext_opt(struct ext_profile *ext, const char *key,
 		dbus_message_iter_get_basic(value, &str);
 		free(ext->service);
 		ext->service = bt_name2string(str);
+		if (ext->service == NULL)
+			return -EINVAL;
 	}
 
 	return 0;