Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/usbdevs Don't read beyond the end of the array when...
details: https://anonhg.NetBSD.org/src/rev/1ba4d804a587
branches: trunk
changeset: 817765:1ba4d804a587
user: skrll <skrll%NetBSD.org@localhost>
date: Wed Sep 07 08:05:02 2016 +0000
description:
Don't read beyond the end of the array when given a overly large number
of ports on a hub.
diffstat:
usr.sbin/usbdevs/usbdevs.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 37e2b0b22fd1 -r 1ba4d804a587 usr.sbin/usbdevs/usbdevs.c
--- a/usr.sbin/usbdevs/usbdevs.c Tue Sep 06 07:45:41 2016 +0000
+++ b/usr.sbin/usbdevs/usbdevs.c Wed Sep 07 08:05:02 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdevs.c,v 1.33 2016/09/02 05:59:04 skrll Exp $ */
+/* $NetBSD: usbdevs.c,v 1.34 2016/09/07 08:05:02 skrll Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: usbdevs.c,v 1.33 2016/09/02 05:59:04 skrll Exp $");
+__RCSID("$NetBSD: usbdevs.c,v 1.34 2016/09/07 08:05:02 skrll Exp $");
#endif
#include <stdio.h>
@@ -261,7 +261,7 @@
}
if (!rec)
return;
- for (p = 0; p < di.udi_nports; p++) {
+ for (p = 0; p < di.udi_nports && p < __arraycount(di.udi_ports); p++) {
int s = di.udi_ports[p];
if (s >= USB_MAX_DEVICES) {
if (verbose) {
Home |
Main Index |
Thread Index |
Old Index