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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/device.c  | 4 ++++
 src/profile.c | 2 ++
 2 files changed, 6 insertions(+)

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;
-- 
2.39.5





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux