Diff between f01e006a26e42581c092efc10b68c2f51f3bb6f3 and 0f4b19f7f94df696983d0ce3bb0515e960474cba

Changed Files

File Additions Deletions Status
src/shared/btsnoop.c +5 -0 modified

Full Patch

diff --git a/src/shared/btsnoop.c b/src/shared/btsnoop.c
index 255775e..f367aff 100644
--- a/src/shared/btsnoop.c
+++ b/src/shared/btsnoop.c
@@ -410,6 +410,11 @@ static bool pklg_read_hci(struct btsnoop *btsnoop, struct timeval *tv,
 		tv->tv_usec = ts & 0xffffffff;
 	}
 
+	if (toread > BTSNOOP_MAX_PACKET_SIZE) {
+                btsnoop->aborted = true;
+                return false;
+        }
+
 	switch (pkt.type) {
 	case 0x00:
 		*index = 0x0000;