lib/uuid: Fix string to uuid32 conversion
authorArchie Pusaka <apusaka@chromium.org>
Wed, 19 May 2021 08:21:14 +0000 (16:21 +0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:35 +0000 (19:08 +0530)
Use strtoul to prevent 32 bit overflow

Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
lib/uuid.c

index a09321d..3d97dc8 100755 (executable)
@@ -209,7 +209,7 @@ static int bt_string_to_uuid32(bt_uuid_t *uuid, const char *string)
        uint32_t u32;
        char *endptr = NULL;
 
-       u32 = strtol(string, &endptr, 16);
+       u32 = strtoul(string, &endptr, 16);
        if (endptr && *endptr == '\0') {
                bt_uuid32_create(uuid, u32);
                return 0;