diff options
author | Bruce Momjian <bruce@momjian.us> | 2014-04-17 12:37:53 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2014-04-17 12:37:53 -0400 |
commit | fc02b87e2876b2492a3d5eebd3b70be383b08f40 (patch) | |
tree | 19301491c363e8f87b15d53f1f742b5975161749 /contrib/pgcrypto/internal-sha2.c | |
parent | 179c45ae2fb9519a343bc2e38ebe4609097d14af (diff) |
pgcrypto: fix memset() calls that might be optimized away
Specifically, on-stack memset() might be removed, so:
* Replace memset() with px_memset()
* Add px_memset to copy_crlf()
* Add px_memset to pgp-s2k.c
Patch by Marko Kreen
Report by PVS-Studio
Backpatch through 8.4.
Diffstat (limited to 'contrib/pgcrypto/internal-sha2.c')
-rw-r--r-- | contrib/pgcrypto/internal-sha2.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/pgcrypto/internal-sha2.c b/contrib/pgcrypto/internal-sha2.c index f86b47816bd..912effb1412 100644 --- a/contrib/pgcrypto/internal-sha2.c +++ b/contrib/pgcrypto/internal-sha2.c @@ -84,7 +84,7 @@ int_sha224_free(PX_MD *h) { SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; - memset(ctx, 0, sizeof(*ctx)); + px_memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); } @@ -132,7 +132,7 @@ int_sha256_free(PX_MD *h) { SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; - memset(ctx, 0, sizeof(*ctx)); + px_memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); } @@ -180,7 +180,7 @@ int_sha384_free(PX_MD *h) { SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; - memset(ctx, 0, sizeof(*ctx)); + px_memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); } @@ -228,7 +228,7 @@ int_sha512_free(PX_MD *h) { SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; - memset(ctx, 0, sizeof(*ctx)); + px_memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); } |