diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-02-09 16:03:45 -0800 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-02-09 16:03:45 -0800 |
commit | f3ddc7444285a0144b8265771ea26198191948ec (patch) | |
tree | 9a67d7029849f2a1f2e16dfcdc8acb8818741ef8 /lib | |
parent | c70b23d33b2952487543fdd580535a0ecf33bdcb (diff) | |
download | bluez-f3ddc7444285a0144b8265771ea26198191948ec.tar.gz |
uuid: Fix crashing if a NULL string is passed to bt_string_to_uuid
bt_string_to_uuid shall chack if the string is valid before attempting
to access its contents.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/uuid.c | 3 |
1 files changed, 3 insertions, 0 deletions
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)) |