File hcidump-Fixed-malformed-segment-frame-length.patch of Package bluez.27443

From da04ba5e6b3f151c1644a17ac0fa2317ebc81edd Mon Sep 17 00:00:00 2001
From: "Cho, Yu-Chen" <acho@suse.com>
Date: Tue, 15 Oct 2019 15:45:43 +0800
Subject: [PATCH] hcidump: Fixed malformed segment frame length

Ensure the L2CAP SDUs whose length field match the actual frame length.
---
 tools/parser/l2cap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/parser/l2cap.c b/tools/parser/l2cap.c
index a05796482..f57885074 100644
--- a/tools/parser/l2cap.c
+++ b/tools/parser/l2cap.c
@@ -771,6 +771,11 @@ static inline void conf_rsp(int level, l2cap_cmd_hdr *cmd, struct frame *frm)
 			scid, btohs(h->flags), result, clen);
 
 	if (clen > 0) {
+	        if (clen != (btohs(frm->len) - L2CAP_CONF_RSP_SIZE)) {
+			fprintf(stderr, "Not match the actual frame length\n");
+			clen = btohs(frm->len) - L2CAP_CONF_RSP_SIZE;
+		}
+
 		if (result) {
 			p_indent(level + 1, frm);
 			printf("%s\n", confresult2str(result));
-- 
2.23.0

openSUSE Build Service is sponsored by