Fix "GATT Read Multiple Variable Response" builder 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:298fdca3f2700432e30c2a1fdfec6f93af453dd8) Merged-In: Ida4f6b566cf9fa40fc5330d8084c29669ccaa608 Change-Id: Ida4f6b566cf9fa40fc5330d8084c29669ccaa608
diff --git a/system/stack/gatt/gatt_sr.cc b/system/stack/gatt/gatt_sr.cc index 06bf5c9..352ca5d 100644 --- a/system/stack/gatt/gatt_sr.cc +++ b/system/stack/gatt/gatt_sr.cc
@@ -212,7 +212,7 @@ 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) { log::verbose("Buffer space not enough for this data item, skipping"); break; }