mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
202033c013
This adds 3 expat patches for n-asb-2022-09 from https://github.com/syphyr/android_external_expat/commits/cm-14.1 and also applies 2 of them to 15.1 Signed-off-by: Tad <tad@spotco.us>
41 lines
1.4 KiB
Diff
41 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Venkata Jagadeesh Garaga <quic_vgaraga@quicinc.com>
|
|
Date: Tue, 22 Mar 2022 13:35:43 +0530
|
|
Subject: [PATCH] Fix OOB in reassemble_and_dispatch
|
|
|
|
Fix OOB while reading L2cap length in HCI pkt
|
|
|
|
Change-Id: I7f32b171e8c68b9724f95fcf2327959539e2d0d5
|
|
CRs-Fixed: 3155132
|
|
---
|
|
hci/src/packet_fragmenter.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/hci/src/packet_fragmenter.c b/hci/src/packet_fragmenter.c
|
|
index f1d302238..b2ebefe0e 100644
|
|
--- a/hci/src/packet_fragmenter.c
|
|
+++ b/hci/src/packet_fragmenter.c
|
|
@@ -130,12 +130,10 @@ static void reassemble_and_dispatch(UNUSED_ATTR BT_HDR *packet) {
|
|
if ((packet->event & MSG_EVT_MASK) == MSG_HC_TO_STACK_HCI_ACL) {
|
|
uint8_t *stream = packet->data;
|
|
uint16_t handle;
|
|
- uint16_t l2cap_length;
|
|
uint16_t acl_length;
|
|
|
|
STREAM_TO_UINT16(handle, stream);
|
|
STREAM_TO_UINT16(acl_length, stream);
|
|
- STREAM_TO_UINT16(l2cap_length, stream);
|
|
|
|
assert(acl_length == packet->len - HCI_ACL_PREAMBLE_SIZE);
|
|
|
|
@@ -166,6 +164,9 @@ static void reassemble_and_dispatch(UNUSED_ATTR BT_HDR *packet) {
|
|
return;
|
|
}
|
|
|
|
+ uint16_t l2cap_length;
|
|
+ STREAM_TO_UINT16(l2cap_length, stream);
|
|
+
|
|
uint16_t full_length = l2cap_length + L2CAP_HEADER_SIZE + HCI_ACL_PREAMBLE_SIZE;
|
|
|
|
// Check for buffer overflow and that the full packet size + BT_HDR size is less than
|