linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 03/12] btmon: fix segfault caused by buffer over-read
@ 2018-10-16 20:20 Matias Karhumaa
  0 siblings, 0 replies; only message in thread
From: Matias Karhumaa @ 2018-10-16 20:20 UTC (permalink / raw)
  To: linux-bluetooth

Fix segfault caused by buffer over-read in packet_hci_scodata function
of monitor/packet.c.

Fix is to check that index is not bigger than MAX_INDEX.

This bug was found by fuzzing with AFL.
---
 monitor/packet.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/monitor/packet.c b/monitor/packet.c
index 3e2a08a1c..fb6d7e46c 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -10170,6 +10170,11 @@ void packet_hci_scodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	uint8_t flags = acl_flags(handle);
 	char handle_str[16], extra_str[32];
 
+	if (index > MAX_INDEX) {
+		print_field("Invalid index (%d).", index);
+		return;
+	}
+
 	index_list[index].frame++;
 
 	if (size < HCI_SCO_HDR_SIZE) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-16 20:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16 20:20 [PATCH 03/12] btmon: fix segfault caused by buffer over-read Matias Karhumaa

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).