gatt_client: set uuid16 to zero when deserializing uuid128 services, characteristics, and descriptors

This commit is contained in:
Matthias Ringwald 2020-01-21 19:12:01 +01:00
parent 908a73e370
commit c839c6f943
2 changed files with 8 additions and 1 deletions

View File

@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- L2CAP ERTM: avoid read-after-free on decline of incoming connection
- GATT Client: set uuid16 to zero when deserializing uuid128 services, characteristics, and descriptors
### Added
- att_db_util: provide GATT Database Hash via att_db_util_hash_calc
- GATT Compiler: provide GATT Database Hash via GATT_DATABASE_HASH Characteristic

View File

@ -2087,6 +2087,8 @@ void gatt_client_deserialize_service(const uint8_t *packet, int offset, gatt_cli
reverse_128(&packet[offset + 4], service->uuid128);
if (uuid_has_bluetooth_prefix(service->uuid128)){
service->uuid16 = big_endian_read_32(service->uuid128, 0);
} else {
service->uuid16 = 0;
}
}
@ -2098,6 +2100,8 @@ void gatt_client_deserialize_characteristic(const uint8_t * packet, int offset,
reverse_128(&packet[offset+8], characteristic->uuid128);
if (uuid_has_bluetooth_prefix(characteristic->uuid128)){
characteristic->uuid16 = big_endian_read_32(characteristic->uuid128, 0);
} else {
characteristic->uuid16 = 0;
}
}
@ -2106,6 +2110,8 @@ void gatt_client_deserialize_characteristic_descriptor(const uint8_t * packet, i
reverse_128(&packet[offset+2], descriptor->uuid128);
if (uuid_has_bluetooth_prefix(descriptor->uuid128)){
descriptor->uuid16 = big_endian_read_32(descriptor->uuid128, 0);
} else {
descriptor->uuid16 = 0;
}
}