Source-Changes-HG archive

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

[src/trunk]: src/sys/net Zeroize the length explicitly when malloc failed. P...



details:   https://anonhg.NetBSD.org/src/rev/e87a7302dedc
branches:  trunk
changeset: 366027:e87a7302dedc
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Tue May 10 09:05:03 2022 +0000

description:
Zeroize the length explicitly when malloc failed.  Pointed out by yamaguchi@n.o.

diffstat:

 sys/net/if_pppoe.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r bb5e75468eac -r e87a7302dedc sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Tue May 10 09:00:39 2022 +0000
+++ b/sys/net/if_pppoe.c        Tue May 10 09:05:03 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.179 2022/05/04 14:30:04 martin Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.180 2022/05/10 09:05:03 knakahara Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.179 2022/05/04 14:30:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.180 2022/05/10 09:05:03 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -953,6 +953,7 @@
                        if (sc->sc_ac_cookie == NULL) {
                                pppoe_printf(sc, "FATAL: could not allocate memory "
                                    "for AC cookie\n");
+                               sc->sc_ac_cookie_len = 0;
                                PPPOE_UNLOCK(sc);
                                goto done;
                        }
@@ -971,6 +972,7 @@
                        if (sc->sc_relay_sid == NULL) {
                                pppoe_printf(sc, "FATAL: could not allocate memory "
                                    "for relay SID\n");
+                               sc->sc_relay_sid_len = 0;
                                PPPOE_UNLOCK(sc);
                                goto done;
                        }



Home | Main Index | Thread Index | Old Index