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.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.c')
-rw-r--r-- | contrib/pgcrypto/internal.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/pgcrypto/internal.c b/contrib/pgcrypto/internal.c index fedfe2dd039..6c334ff6d6a 100644 --- a/contrib/pgcrypto/internal.c +++ b/contrib/pgcrypto/internal.c @@ -143,7 +143,7 @@ int_md5_free(PX_MD *h) { MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; - memset(ctx, 0, sizeof(*ctx)); + px_memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); } @@ -191,7 +191,7 @@ int_sha1_free(PX_MD *h) { SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; - memset(ctx, 0, sizeof(*ctx)); + px_memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); } @@ -266,7 +266,7 @@ intctx_free(PX_Cipher *c) if (cx) { - memset(cx, 0, sizeof *cx); + px_memset(cx, 0, sizeof *cx); px_free(cx); } px_free(c); @@ -659,7 +659,7 @@ system_reseed(void) skip = buf[0] >= SYSTEM_RESEED_CHANCE; } /* clear 1 byte */ - memset(buf, 0, sizeof(buf)); + px_memset(buf, 0, sizeof(buf)); if (skip) return; @@ -669,7 +669,7 @@ system_reseed(void) fortuna_add_entropy(buf, n); seed_time = t; - memset(buf, 0, sizeof(buf)); + px_memset(buf, 0, sizeof(buf)); } int |