Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Don't leak kernel stack data when an enaddr can'...



details:   https://anonhg.NetBSD.org/src/rev/cd2790bef7ca
branches:  trunk
changeset: 756360:cd2790bef7ca
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Wed Jul 14 04:50:28 2010 +0000

description:
Don't leak kernel stack data when an enaddr can't be found.

diffstat:

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

diffs (30 lines):

diff -r 909fe03e27bb -r cd2790bef7ca sys/dev/pci/if_cas.c
--- a/sys/dev/pci/if_cas.c      Wed Jul 14 00:11:06 2010 +0000
+++ b/sys/dev/pci/if_cas.c      Wed Jul 14 04:50:28 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cas.c,v 1.9 2010/06/17 06:41:05 mrg Exp $   */
+/*     $NetBSD: if_cas.c,v 1.10 2010/07/14 04:50:28 jnemeth Exp $      */
 /*     $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $    */
 
 /*
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.9 2010/06/17 06:41:05 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.10 2010/07/14 04:50:28 jnemeth Exp $");
 
 #include "opt_inet.h"
 
@@ -335,8 +335,10 @@
        if ((data = prop_dictionary_get(device_properties(sc->sc_dev),
            "mac-address")) != NULL)
                memcpy(enaddr, prop_data_data_nocopy(data), ETHER_ADDR_LEN);
-       else if (cas_pci_enaddr(sc, pa, enaddr) != 0)
+       else if (cas_pci_enaddr(sc, pa, enaddr) != 0) {
                aprint_error_dev(sc->sc_dev, "no Ethernet address found\n");
+               memset(enaddr, 0, sizeof(enaddr));
+       }
 
        sc->sc_burst = 16;      /* XXX */
 



Home | Main Index | Thread Index | Old Index