Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Avoid buffer overflow which was added in rev. 1.52.



details:   https://anonhg.NetBSD.org/src/rev/025e704b50e8
branches:  trunk
changeset: 329670:025e704b50e8
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Jun 03 13:53:28 2014 +0000

description:
Avoid buffer overflow which was added in rev. 1.52.
This change fix a panic at boot time (PR#47950 Reported by Bert Kiers).

 OK'd by tls.

diffstat:

 sys/dev/pci/hifn7751.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r b3241213ff16 -r 025e704b50e8 sys/dev/pci/hifn7751.c
--- a/sys/dev/pci/hifn7751.c    Tue Jun 03 13:51:52 2014 +0000
+++ b/sys/dev/pci/hifn7751.c    Tue Jun 03 13:53:28 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hifn7751.c,v 1.54 2014/03/29 19:28:24 christos Exp $   */
+/*     $NetBSD: hifn7751.c,v 1.55 2014/06/03 13:53:28 msaitoh Exp $    */
 /*     $FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
 /*     $OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $  */
 
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.54 2014/03/29 19:28:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.55 2014/06/03 13:53:28 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -700,6 +700,7 @@
 
                if (sc->sc_rng_need) {
                        nwords = (sc->sc_rng_need * NBBY) / HIFN_RNG_BITSPER;
+                       nwords = MIN(__arraycount(num), nwords);
                }
 
                if (nwords < 2) {



Home | Main Index | Thread Index | Old Index