From fc02b87e2876b2492a3d5eebd3b70be383b08f40 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 17 Apr 2014 12:37:53 -0400 Subject: 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. --- contrib/pgcrypto/pgp-s2k.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'contrib/pgcrypto/pgp-s2k.c') diff --git a/contrib/pgcrypto/pgp-s2k.c b/contrib/pgcrypto/pgp-s2k.c index 349234e243c..40c05a1a96e 100644 --- a/contrib/pgcrypto/pgp-s2k.c +++ b/contrib/pgcrypto/pgp-s2k.c @@ -75,6 +75,7 @@ calc_s2k_simple(PGP_S2K *s2k, PX_MD *md, const uint8 *key, remain = 0; } } + px_memset(buf, 0, sizeof(buf)); return 0; } @@ -118,6 +119,7 @@ calc_s2k_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len) remain = 0; } } + px_memset(buf, 0, sizeof(buf)); return 0; } @@ -189,6 +191,7 @@ calc_s2k_iter_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key, remain = 0; } } + px_memset(buf, 0, sizeof(buf)); return 0; } -- cgit v1.2.3