[PATCH BlueZ 2/2] uuid: Fix crashing if a NULL string is passed to bt_string_to_uuid

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

bt_string_to_uuid shall chack if the string is valid before attempting
to access its contents.
---
 lib/uuid.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/uuid.c b/lib/uuid.c
index 3d97dc835..1d2e1f732 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -251,6 +251,9 @@ static int bt_string_to_uuid128(bt_uuid_t *uuid, const char *string)
 
 int bt_string_to_uuid(bt_uuid_t *uuid, const char *string)
 {
+	if (!string)
+		return -EINVAL;
+
 	if (is_base_uuid128(string))
 		return bt_string_to_uuid16(uuid, string + 4);
 	else if (is_uuid128(string))
-- 
2.34.1




[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