Fixed paired device config UUID parsing logic

Also added unit tests to cover this bug.

Bug: 26883553
Change-Id: Ice8641fad5c38ee43f1b080665dde70979f9d60f
diff --git a/btif/src/btif_util.c b/btif/src/btif_util.c
index 27d68c2..f4cffcb 100644
--- a/btif/src/btif_util.c
+++ b/btif/src/btif_util.c
@@ -30,6 +30,7 @@
 
 #include "btif_util.h"
 
+#include <assert.h>
 #include <ctype.h>
 #include <netinet/in.h>
 #include <stdio.h>
@@ -111,13 +112,19 @@
     memcpy(uuid128->uu + 2, &uuid16_bo, sizeof(uint16_t));
 }
 
-void string_to_uuid(const char *str, bt_uuid_t *p_uuid)
+bool string_to_uuid(const char *str, bt_uuid_t *p_uuid)
 {
+    assert(p_uuid);
+    if (str == NULL)
+        return false;
+
     uint32_t uuid0, uuid4;
     uint16_t uuid1, uuid2, uuid3, uuid5;
 
-    sscanf(str, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
+    int rc = sscanf(str, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
                 &uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
+    if (rc != 6)
+        return false;
 
     uuid0 = htonl(uuid0);
     uuid1 = htons(uuid1);
@@ -133,8 +140,7 @@
     memcpy(&(p_uuid->uu[10]), &uuid4, 4);
     memcpy(&(p_uuid->uu[14]), &uuid5, 2);
 
-    return;
-
+    return true;
 }
 
 void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str)