Diff between 5cbaca45cf907191f76256d08ec11ddb57e4f0d1 and d70f145e03e771a9a6ba7b2654fdd44aada57bfe

Changed Files

File Additions Deletions Status
tools/parser/l2cap.c +6 -2 modified

Full Patch

diff --git a/tools/parser/l2cap.c b/tools/parser/l2cap.c
index a494198..8d513f8 100644
--- a/tools/parser/l2cap.c
+++ b/tools/parser/l2cap.c
@@ -699,8 +699,12 @@ static void l2cap_parse(int level, struct frame *frm)
 					hdr->code, hdr->ident, btohs(hdr->len));
 				raw_dump(level, frm);
 			}
-			frm->ptr += btohs(hdr->len);
-			frm->len -= btohs(hdr->len);
+
+			if (frm->len > btohs(hdr->len)) {
+				frm->len -= btohs(hdr->len);
+				frm->ptr += btohs(hdr->len);
+			} else
+				frm->len = 0;
 		}
 	} else if (cid == 0x2) {
 		/* Connectionless channel */