Diff between 711424319562ef2efcb7ad0d5f264400f72af8fd and f77ed4911e01a43659d2daaa3724450489f6126b

Changed Files

File Additions Deletions Status
src/uuid-helper.c +5 -7 modified

Full Patch

diff --git a/src/uuid-helper.c b/src/uuid-helper.c
index b62b1af..f32ee0a 100644
--- a/src/uuid-helper.c
+++ b/src/uuid-helper.c
@@ -169,8 +169,8 @@ static int string2uuid16(uuid_t *uuid, const char *string)
 char *bt_name2string(const char *pattern)
 {
 	uuid_t uuid;
-	uint16_t uuid16;
-	int i;
+	unsigned int uuid16;
+	char *endptr = NULL;
 
 	/* UUID 128 string format */
 	if (is_uuid128(pattern))
@@ -182,11 +182,9 @@ char *bt_name2string(const char *pattern)
 		goto proceed;
 
 	/* HEX format */
-	uuid16 = strtol(pattern, NULL, 16);
-	for (i = 0; bt_services[i].class; i++) {
-		if (bt_services[i].class == uuid16)
-			goto proceed;
-	}
+	uuid16 = strtoul(pattern, &endptr, 16);
+	if (uuid16 <= 0xffff && *endptr == '\0')
+		goto proceed;
 
 	return NULL;