OSDN Git Service

BNEP: Fix OOB access in bnep_data_ind
authorJack He <siyuanh@google.com>
Fri, 1 Jun 2018 21:00:42 +0000 (14:00 -0700)
committerJack He <siyuanh@google.com>
Fri, 1 Jun 2018 21:50:59 +0000 (14:50 -0700)
commit3c799a6e25abdf6bacb660ff7a06338836cc7356
treea0ab4f489bdfbe66a9813ffca4c1f8e36ff10340
parent4262b932e487b19d578d79e0120cf03291f44efc
BNEP: Fix OOB access in bnep_data_ind

* Stop reading the L2CAP packet if packet length is 0
* Process the buffer for BNEP_EXTENSION_CONTROL packet before advancing
  the buffer pointer by length of payload
* Reject BNEP_EXTENSION_CONTROL packet when the payload size is zero
* Move error logging to more appropriate locations at where the OOB access
  is most likely triggered

Bug: 78286118
Bug: 79164722
Test: Send zero length L2CAP packet to BNEP, send invalid
      BNEP_EXTENSION_CONTROL packet

Change-Id: I7e18632b8faab1b6aaca1bff1b7f55d69962729e
stack/bnep/bnep_main.cc