[PATCH 09/12] btmon: fix segfault caused by buffer over-read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix segfault caused by buffer over-read in btmon. Fix is to check in
packet_monitor() that index is not bigger than MAX_INDEX before accessing
index_list.

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 1e9f9d9e4..2d8e15597 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -3864,6 +3864,11 @@ void packet_monitor(struct timeval *tv, struct ucred *cred,
 		index_current = index;
 	}
 
+	if (index != HCI_DEV_NONE && index > MAX_INDEX) {
+		print_field("Invalid index (%d)", index);
+		return;
+	}
+
 	if (tv && time_offset == ((time_t) -1))
 		time_offset = tv->tv_sec;
 
-- 
2.17.1




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux