Source-Changes-HG archive

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

[src/trunk]: src/sys/dev clear freed memory



details:   https://anonhg.NetBSD.org/src/rev/17f6c61283ef
branches:  trunk
changeset: 579622:17f6c61283ef
user:      dan <dan%NetBSD.org@localhost>
date:      Sat Mar 19 21:39:17 2005 +0000

description:
clear freed memory

diffstat:

 sys/dev/cgd_crypto.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (50 lines):

diff -r 96eae86990f9 -r 17f6c61283ef sys/dev/cgd_crypto.c
--- a/sys/dev/cgd_crypto.c      Sat Mar 19 18:45:08 2005 +0000
+++ b/sys/dev/cgd_crypto.c      Sat Mar 19 21:39:17 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd_crypto.c,v 1.3 2004/03/18 10:42:08 dan Exp $ */
+/* $NetBSD: cgd_crypto.c,v 1.4 2005/03/19 21:39:17 dan Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd_crypto.c,v 1.3 2004/03/18 10:42:08 dan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd_crypto.c,v 1.4 2005/03/19 21:39:17 dan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -202,6 +202,7 @@
 {
        struct aes_privdata *apd = (void *)data;
 
+       memset(apd, 0, sizeof(*apd));
        free(apd, M_DEVBUF);
 }
 
@@ -300,6 +301,7 @@
        error |= des_key_sched((des_cblock *)key + 1, cp->cp_key2);
        error |= des_key_sched((des_cblock *)key + 2, cp->cp_key3);
        if (error) {
+               memset(cp, 0, sizeof(*cp));
                free(cp, M_DEVBUF);
                return NULL;
        }
@@ -311,6 +313,7 @@
 {
        struct c3des_privdata *cp = (void *)data;
 
+       memset(cp, 0, sizeof(*cp));
        free(cp, M_DEVBUF);
 }
 
@@ -410,6 +413,7 @@
 {
        struct  bf_privdata *bp = (void *)data;
 
+       memset(bp, 0, sizeof(*bp));
        free(bp, M_DEVBUF);
 }
 



Home | Main Index | Thread Index | Old Index