From cd058113989dd459188f08215fb6cac2e1a8d8ca Mon Sep 17 00:00:00 2001 From: sf Date: Mon, 19 Sep 2011 21:13:55 +0000 Subject: Backport r1172825: Fix issue found by PVS-Studio static analyzer: Correctly clear whole sha256 state PR: 51542 Submitted by: Andrey Karpov git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@1172829 13f79535-47bb-0310-9956-ffa450edef68 --- random/unix/sha2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/random/unix/sha2.c b/random/unix/sha2.c index 070526d9d..212c1b732 100644 --- a/random/unix/sha2.c +++ b/random/unix/sha2.c @@ -557,7 +557,7 @@ void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { } /* Clean up state data: */ - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); usedspace = 0; } @@ -578,7 +578,7 @@ char *apr__SHA256_End(SHA256_CTX* context, char buffer[]) { } *buffer = (char)0; } else { - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH); return buffer; @@ -889,7 +889,7 @@ void apr__SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { } /* Zero out state data */ - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) { @@ -909,7 +909,7 @@ char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) { } *buffer = (char)0; } else { - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH); return buffer; @@ -964,7 +964,7 @@ void apr__SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { } /* Zero out state data */ - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) { @@ -984,7 +984,7 @@ char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) { } *buffer = (char)0; } else { - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH); return buffer; -- cgit v1.2.1