Comparision of NULL string in g_ascii_strcasecmp 19/42019/1
authorAnchit Narang <anchit.n@samsung.com>
Mon, 22 Jun 2015 05:02:03 +0000 (10:32 +0530)
committerAnchit Narang <anchit.n@samsung.com>
Mon, 22 Jun 2015 05:02:03 +0000 (10:32 +0530)
In function __get_gatt_handle_by_uuid, __convert_uuid_to_uuid128 may return NULL

g_ascii_strcasecmp returns 0 if one of the strings is NULL

This will cause the function __get_gatt_handle_by_uuid to return invalid gatt handle

Change-Id: I25147f5ac350defaa71ea29b8cf75a3de9a493bd

src/bluetooth-gatt.c

index 8ebffc2f45e38855d4287e8e9eae6e0efc50c6eb..db8af59ebf63e26ec1d68d08b2b5ee8377f45268 100644 (file)
@@ -103,6 +103,8 @@ static int __get_gatt_handle_by_uuid(GSList *list, const char *uuid,
                bt_gatt_common_s *common = (bt_gatt_common_s *)l->data;
 
                uuid128_b = __convert_uuid_to_uuid128(common->uuid);
+               if (uuid128_b == NULL)
+                       continue;
                if (g_ascii_strcasecmp(uuid128_a, uuid128_b) == 0) {
                        g_free(uuid128_b);
                        break;