diff options
author | Bruce Momjian | 2014-04-17 16:37:53 +0000 |
---|---|---|
committer | Bruce Momjian | 2014-04-17 16:37:53 +0000 |
commit | 9fe55259fd61fd9199907623f974caa7af66e780 (patch) | |
tree | 2d2d7fc333474267d375ca35db482b8a4e42e253 /contrib/pgcrypto/pgp-pubkey.c | |
parent | 83defef8c794e7772e4099a7efa2ebac3c62742c (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/pgp-pubkey.c')
-rw-r--r-- | contrib/pgcrypto/pgp-pubkey.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/pgcrypto/pgp-pubkey.c b/contrib/pgcrypto/pgp-pubkey.c index 9651d5e89f2..abab0581235 100644 --- a/contrib/pgcrypto/pgp-pubkey.c +++ b/contrib/pgcrypto/pgp-pubkey.c @@ -77,7 +77,7 @@ pgp_key_free(PGP_PubKey *pk) pgp_mpi_free(pk->sec.dsa.x); break; } - memset(pk, 0, sizeof(*pk)); + px_memset(pk, 0, sizeof(*pk)); px_free(pk); } @@ -150,7 +150,7 @@ calc_key_id(PGP_PubKey *pk) px_md_free(md); memcpy(pk->key_id, hash + 12, 8); - memset(hash, 0, 20); + px_memset(hash, 0, 20); return 0; } @@ -291,8 +291,8 @@ check_key_sha1(PullFilter *src, PGP_PubKey *pk) res = PXE_PGP_KEYPKT_CORRUPT; } err: - memset(got_sha1, 0, 20); - memset(my_sha1, 0, 20); + px_memset(got_sha1, 0, 20); + px_memset(my_sha1, 0, 20); return res; } |