diff --git a/tools/btsnoop.c b/tools/btsnoop.c
index efaa45d..0bd28b6 100644
--- a/tools/btsnoop.c
+++ b/tools/btsnoop.c
acl_flags = buf[2] >> 4;
/* use only packet with ACL start flag */
- if (acl_flags & 0x02) {
+ if ((acl_flags & 0x02) && len > 9) {
if (current_cid == 0x0040 && pdu_len > 0) {
int i;
if (!pdu_first)
current_cid = buf[8] << 8 | buf[7];
memcpy(pdu_buf, buf + 9, len - 9);
pdu_len = len - 9;
- } else if (acl_flags & 0x01) {
+ } else if ((acl_flags & 0x01) && len > 5) {
memcpy(pdu_buf + pdu_len, buf + 5, len - 5);
pdu_len += len - 5;
}