All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cho, Yu-Chen" <acho@suse.com>
To: linux-bluetooth@vger.kernel.org
Cc: acho@suse.com, jlee@suse.com
Subject: [PATCH 2/3 BlueZ] hcidump:fixed hci frame dump stack-buffer-overflow
Date: Wed, 31 Oct 2018 16:15:07 +0800	[thread overview]
Message-ID: <20181031081508.25927-3-acho@suse.com> (raw)
In-Reply-To: <20181031081508.25927-1-acho@suse.com>

hci_dump() didn't check the length of frame, and it would be
a stack-buffer-overflow error.

Signed-off-by: Cho, Yu-Chen <acho@suse.com>
---
 tools/parser/hci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/parser/hci.c b/tools/parser/hci.c
index 8c7bd2581..4e6c36040 100644
--- a/tools/parser/hci.c
+++ b/tools/parser/hci.c
@@ -4107,6 +4107,9 @@ void hci_dump(int level, struct frame *frm)
 
 	frm->ptr++; frm->len--;
 
+	if (frm->len == 0)
+		return;
+
 	switch (type) {
 	case HCI_COMMAND_PKT:
 		command_dump(level, frm);
-- 
2.19.1


  parent reply	other threads:[~2018-10-31  8:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31  8:15 [PATCH 0/3 BlueZ] hcidump: fix buffer overflow Cho, Yu-Chen
2018-10-31  8:15 ` [PATCH 1/3 BlueZ] hcidump: fixed AMP Assoc dump heap-over-flow Cho, Yu-Chen
2018-11-02 10:54   ` Luiz Augusto von Dentz
2018-11-06  6:57     ` Cho, Yu-Chen
2018-10-31  8:15 ` Cho, Yu-Chen [this message]
2018-11-02 11:11   ` [PATCH 2/3 BlueZ] hcidump:fixed hci frame dump stack-buffer-overflow Luiz Augusto von Dentz
2018-10-31  8:15 ` [PATCH 3/3 BlueZ] hcidump: Fix set_ext_ctrl() global buffer overflow Cho, Yu-Chen
2018-11-02 11:12   ` Luiz Augusto von Dentz

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=20181031081508.25927-3-acho@suse.com \
    --to=acho@suse.com \
    --cc=jlee@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.