From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Paw=C5=82owski?= Date: Thu, 1 Aug 2024 14:12:58 +0000 Subject: [PATCH] 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:167573989a2a11a71af1289615692c360c14bddf) Merged-In: Ida4f6b566cf9fa40fc5330d8084c29669ccaa608 Change-Id: Ida4f6b566cf9fa40fc5330d8084c29669ccaa608 --- stack/gatt/gatt_sr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack/gatt/gatt_sr.cc b/stack/gatt/gatt_sr.cc index 413f91c80..e2f011a0a 100644 --- a/stack/gatt/gatt_sr.cc +++ b/stack/gatt/gatt_sr.cc @@ -178,7 +178,7 @@ static bool process_read_multi_rsp(tGATT_SR_CMD* p_cmd, tGATT_STATUS status, 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; }