From: Matias Karhumaa <matias.karhumaa@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 08/12] btmon: fix segfault caused by integer undeflow
Date: Tue, 16 Oct 2018 23:23:12 +0300 [thread overview]
Message-ID: <20181016202312.GA85016@Matias-MacBook-Air.local> (raw)
Fix segfault caused by integer underflow. Fix is to check that
rsp->num_codecs + 3 is not bigger than size before subtracting.
Crash was found by fuzzing btmon with AFL.
---
monitor/packet.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/monitor/packet.c b/monitor/packet.c
index 461f5e84b..1e9f9d9e4 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -5832,6 +5832,11 @@ static void read_local_codecs_rsp(const void *data, uint8_t size)
const struct bt_hci_rsp_read_local_codecs *rsp = data;
uint8_t i, num_vnd_codecs;
+ if (rsp->num_codecs + 3 > size) {
+ print_field("Invalid number of codecs.");
+ return;
+ }
+
print_status(rsp->status);
print_field("Number of supported codecs: %d", rsp->num_codecs);
--
2.17.1
reply other threads:[~2018-10-16 20:19 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=20181016202312.GA85016@Matias-MacBook-Air.local \
--to=matias.karhumaa@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