apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1172825 - /apr/apr/trunk/random/unix/sha2.c
Date Mon, 19 Sep 2011 21:11:39 GMT
Author: sf
Date: Mon Sep 19 21:11:38 2011
New Revision: 1172825

URL: http://svn.apache.org/viewvc?rev=1172825&view=rev
Log:
Fix issue found by PVS-Studio static analyzer:
Correctly clear whole sha256 state

PR: 51542
Submitted by: Andrey Karpov <karpov viva64 com>

Modified:
    apr/apr/trunk/random/unix/sha2.c

Modified: apr/apr/trunk/random/unix/sha2.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/random/unix/sha2.c?rev=1172825&r1=1172824&r2=1172825&view=diff
==============================================================================
--- apr/apr/trunk/random/unix/sha2.c (original)
+++ apr/apr/trunk/random/unix/sha2.c Mon Sep 19 21:11:38 2011
@@ -557,7 +557,7 @@ void apr__SHA256_Final(sha2_byte digest[
         }
 
         /* 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* contex
                 }
                 *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[
         }
 
         /* 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* contex
                 }
                 *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[
         }
 
         /* 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* contex
                 }
                 *buffer = (char)0;
         } else {
-                MEMSET_BZERO(context, sizeof(context));
+                MEMSET_BZERO(context, sizeof(*context));
         }
         MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
         return buffer;



Mime
View raw message