Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/bind/dist/lib/isc Fix memset usage. XXX audit t...



details:   https://anonhg.NetBSD.org/src/rev/4d468331665a
branches:  trunk
changeset: 766733:4d468331665a
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Jul 01 02:24:14 2011 +0000

description:
Fix memset usage. XXX audit the rest where hard coded sizes are used

diffstat:

 external/bsd/bind/dist/lib/isc/hmacsha.c |  12 ++++++------
 external/bsd/bind/dist/lib/isc/sha2.c    |  16 ++++++++--------
 2 files changed, 14 insertions(+), 14 deletions(-)

diffs (126 lines):

diff -r ec7eb3d2a427 -r 4d468331665a external/bsd/bind/dist/lib/isc/hmacsha.c
--- a/external/bsd/bind/dist/lib/isc/hmacsha.c  Fri Jul 01 02:18:54 2011 +0000
+++ b/external/bsd/bind/dist/lib/isc/hmacsha.c  Fri Jul 01 02:24:14 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hmacsha.c,v 1.2 2011/02/16 03:47:11 christos Exp $     */
+/*     $NetBSD: hmacsha.c,v 1.3 2011/07/01 02:24:14 joerg Exp $        */
 
 /*
  * Copyright (C) 2005-2007, 2009  Internet Systems Consortium, Inc. ("ISC")
@@ -227,7 +227,7 @@
 isc_hmacsha1_invalidate(isc_hmacsha1_t *ctx) {
        isc_sha1_invalidate(&ctx->sha1ctx);
        memset(ctx->key, 0, sizeof(ctx->key));
-       memset(ctx, 0, sizeof(ctx));
+       memset(ctx, 0, sizeof(*ctx));
 }
 
 /*
@@ -295,7 +295,7 @@
 void
 isc_hmacsha224_invalidate(isc_hmacsha224_t *ctx) {
        memset(ctx->key, 0, sizeof(ctx->key));
-       memset(ctx, 0, sizeof(ctx));
+       memset(ctx, 0, sizeof(*ctx));
 }
 
 /*
@@ -362,7 +362,7 @@
 void
 isc_hmacsha256_invalidate(isc_hmacsha256_t *ctx) {
        memset(ctx->key, 0, sizeof(ctx->key));
-       memset(ctx, 0, sizeof(ctx));
+       memset(ctx, 0, sizeof(*ctx));
 }
 
 /*
@@ -429,7 +429,7 @@
 void
 isc_hmacsha384_invalidate(isc_hmacsha384_t *ctx) {
        memset(ctx->key, 0, sizeof(ctx->key));
-       memset(ctx, 0, sizeof(ctx));
+       memset(ctx, 0, sizeof(*ctx));
 }
 
 /*
@@ -496,7 +496,7 @@
 void
 isc_hmacsha512_invalidate(isc_hmacsha512_t *ctx) {
        memset(ctx->key, 0, sizeof(ctx->key));
-       memset(ctx, 0, sizeof(ctx));
+       memset(ctx, 0, sizeof(*ctx));
 }
 
 /*
diff -r ec7eb3d2a427 -r 4d468331665a external/bsd/bind/dist/lib/isc/sha2.c
--- a/external/bsd/bind/dist/lib/isc/sha2.c     Fri Jul 01 02:18:54 2011 +0000
+++ b/external/bsd/bind/dist/lib/isc/sha2.c     Fri Jul 01 02:24:14 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sha2.c,v 1.2 2011/02/16 03:47:11 christos Exp $        */
+/*     $NetBSD: sha2.c,v 1.3 2011/07/01 02:24:14 joerg Exp $   */
 
 /*
  * Copyright (C) 2005-2007, 2009  Internet Systems Consortium, Inc. ("ISC")
@@ -897,7 +897,7 @@
        }
 
        /* Clean up state data: */
-       memset(context, 0, sizeof(context));
+       memset(context, 0, sizeof(*context));
        usedspace = 0;
 }
 
@@ -1210,7 +1210,7 @@
        }
 
        /* Zero out state data */
-       memset(context, 0, sizeof(context));
+       memset(context, 0, sizeof(*context));
 }
 
 
@@ -1263,7 +1263,7 @@
        }
 
        /* Zero out state data */
-       memset(context, 0, sizeof(context));
+       memset(context, 0, sizeof(*context));
 }
 #endif /* !ISC_PLATFORM_OPENSSLHASH */
 
@@ -1294,7 +1294,7 @@
 #ifdef ISC_PLATFORM_OPENSSLHASH
                EVP_MD_CTX_cleanup(context);
 #else
-               memset(context, 0, sizeof(context));
+               memset(context, 0, sizeof(*context));
 #endif
        }
        memset(digest, 0, ISC_SHA224_DIGESTLENGTH);
@@ -1333,7 +1333,7 @@
 #ifdef ISC_PLATFORM_OPENSSLHASH
                EVP_MD_CTX_cleanup(context);
 #else
-               memset(context, 0, sizeof(context));
+               memset(context, 0, sizeof(*context));
 #endif
        }
        memset(digest, 0, ISC_SHA256_DIGESTLENGTH);
@@ -1372,7 +1372,7 @@
 #ifdef ISC_PLATFORM_OPENSSLHASH
                EVP_MD_CTX_cleanup(context);
 #else
-               memset(context, 0, sizeof(context));
+               memset(context, 0, sizeof(*context));
 #endif
        }
        memset(digest, 0, ISC_SHA512_DIGESTLENGTH);
@@ -1411,7 +1411,7 @@
 #ifdef ISC_PLATFORM_OPENSSLHASH
                EVP_MD_CTX_cleanup(context);
 #else
-               memset(context, 0, sizeof(context));
+               memset(context, 0, sizeof(*context));
 #endif
        }
        memset(digest, 0, ISC_SHA384_DIGESTLENGTH);



Home | Main Index | Thread Index | Old Index