linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: zefang han <hanzefang@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] tools/hcidump: fix a out-of-bounds read in le_meta_ev_dump()
Date: Sun, 30 Aug 2020 06:07:44 -0700	[thread overview]
Message-ID: <20200830130744.GA10568@ubuntu> (raw)

Check whether the subevent code of le meta event is bigger than
the size of ev_le_meta_str.
---
 tools/parser/hci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/parser/hci.c b/tools/parser/hci.c
index 41f6fe087..acd41be83 100644
--- a/tools/parser/hci.c
+++ b/tools/parser/hci.c
@@ -3668,7 +3668,12 @@ static inline void le_meta_ev_dump(int level, struct frame *frm)
 	frm->len -= EVT_LE_META_EVENT_SIZE;
 
 	p_indent(level, frm);
-	printf("%s\n", ev_le_meta_str[subevent]);
+
+	if (subevent > LE_EV_NUM) {
+		printf("Unknown\n");
+	} else {
+		printf("%s\n", ev_le_meta_str[subevent]);
+	}
 
 	switch (mevt->subevent) {
 	case EVT_LE_CONN_COMPLETE:
-- 
2.17.1


                 reply	other threads:[~2020-08-30 13:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200830130744.GA10568@ubuntu \
    --to=hanzefang@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).