Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 461d717f authored by Hansong Zhang's avatar Hansong Zhang Committed by android-build-merger
Browse files

Merge "HID Host: Check L2CAP packet data length" into oc-dev am: 13dca96c

am: 17349545

Change-Id: I8a85b900e7c8317b49cf0197d8bd5b5052380b34
parents feb094e4 17349545
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
#include "hidh_api.h"
#include "hidh_int.h"

#include "log/log.h"
#include "osi/include/osi.h"

static uint8_t find_conn_by_cid(uint16_t cid);
@@ -799,6 +800,14 @@ static void hidh_l2cif_data_ind(uint16_t l2cap_cid, BT_HDR* p_msg) {
    return;
  }

  if (p_msg->len < 1) {
    HIDH_TRACE_WARNING("Rcvd L2CAP data, invalid length %d, should be >= 1",
                       p_msg->len);
    osi_free(p_msg);
    android_errorWriteLog(0x534e4554, "80493272");
    return;
  }

  ttype = HID_GET_TRANS_FROM_HDR(*p_data);
  param = HID_GET_PARAM_FROM_HDR(*p_data);
  rep_type = param & HID_PAR_REP_TYPE_MASK;