Skip to content

Commit

Permalink
Fix "GATT Read Multiple Variable Response" builder
Browse files Browse the repository at this point in the history
0 length value is perfectly fine, and should result in just length
added into the packet.
Currently, for 0 length value we just break out of loop, and don't add
any value.
This means, that if first characetristic in response had 0 length, we
would return empty packet.

Ignore-AOSP-First: security fix
Test: mma -j32;
Bug: 352696105
Bug: 356886209
Flag: exempt, obvious logic fix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:676d4d0b0bc423fae086f8edf6b9e482780d07d1)
Merged-In: Ida4f6b566cf9fa40fc5330d8084c29669ccaa608
Change-Id: Ida4f6b566cf9fa40fc5330d8084c29669ccaa608
  • Loading branch information
Jakub Pawlowski authored and aoleary committed Dec 30, 2024
1 parent cba3f48 commit 6e82186
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion system/stack/gatt/gatt_sr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static void build_read_multi_rsp(tGATT_SR_CMD* p_cmd, uint16_t mtu) {

len = std::min((size_t) p_rsp->attr_value.len, mtu - total_len);

if (len == 0) {
if (total_len == mtu && p_rsp->attr_value.len > 0) {
VLOG(1) << "Buffer space not enough for this data item, skipping";
break;
}
Expand Down

0 comments on commit 6e82186

Please sign in to comment.