*
******************************************************************************/
+#define LOG_TAG "bt_l2c_main"
+
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
-#include "device/include/controller.h"
-#include "btcore/include/counter.h"
+ #include <log/log.h>
+
#include "bt_target.h"
#include "btm_int.h"
#include "btu.h"
STREAM_TO_UINT16 (hci_len, p);
p_msg->offset += 4;
- GKI_freebuf (p_msg);
+ if (hci_len < L2CAP_PKT_OVERHEAD) {
+ /* Must receive at least the L2CAP length and CID */
+ L2CAP_TRACE_WARNING ("L2CAP - got incorrect hci header");
+ android_errorWriteLog(0x534e4554, "34946955");
++ osi_free(p_msg);
+ return;
+ }
+
/* Extract the length and CID */
STREAM_TO_UINT16 (l2cap_len, p);
STREAM_TO_UINT16 (rcv_cid, p);