OSDN Git Service

Fix GATT Characteristic discovery (server side)
authorJakub Pawlowski <jpawlowski@google.com>
Wed, 27 Sep 2017 16:58:46 +0000 (09:58 -0700)
committerJakub Pawlowski <jpawlowski@google.com>
Wed, 27 Sep 2017 17:02:13 +0000 (10:02 -0700)
The pointer was not properly incremented, which resulted in trashes
being sent during GATT discovery.

This issue was introduced in commit
819e2ecb84a22d6e03ec9ed67b3260c0dd7e8aba (Use one type for UUID)

Bug: 66912853
Test: sl4a GATT read test
Change-Id: Ib57ad050ff17852f9b2fec9c51cad246235e3e80

stack/gatt/gatt_db.cc

index 0ba408e..6ae1a61 100644 (file)
@@ -186,6 +186,7 @@ static tGATT_STATUS read_attr_value(tGATT_ATTR& attr16, uint16_t offset,
     if (mtu < *p_len) return GATT_NO_RESOURCES;
 
     gatt_build_uuid_to_stream(&p, attr16.p_value->uuid);
+    *p_data = p;
     return GATT_SUCCESS;
   }
 
@@ -205,6 +206,7 @@ static tGATT_STATUS read_attr_value(tGATT_ATTR& attr16, uint16_t offset,
       /* if 32 bit UUID, convert to 128 bit */
       ARRAY_TO_STREAM(p, val_attr->uuid.To128BitLE(), (int)Uuid::kNumBytes128);
     }
+    *p_data = p;
     return GATT_SUCCESS;
   }
 
@@ -223,6 +225,7 @@ static tGATT_STATUS read_attr_value(tGATT_ATTR& attr16, uint16_t offset,
     if (incl_handle.service_type.Is16Bit()) {
       UINT16_TO_STREAM(p, incl_handle.service_type.As16Bit());
     }
+    *p_data = p;
     return GATT_SUCCESS;
   }