mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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.
This commit is contained in:
@ -72,7 +72,7 @@ pad_eme_pkcs1_v15(uint8 *data, int data_len, int res_len, uint8 **res_p)
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
memset(buf, 0, res_len);
|
||||
px_memset(buf, 0, res_len);
|
||||
px_free(buf);
|
||||
return res;
|
||||
}
|
||||
@ -122,10 +122,10 @@ create_secmsg(PGP_Context *ctx, PGP_MPI **msg_p, int full_bytes)
|
||||
|
||||
if (padded)
|
||||
{
|
||||
memset(padded, 0, full_bytes);
|
||||
px_memset(padded, 0, full_bytes);
|
||||
px_free(padded);
|
||||
}
|
||||
memset(secmsg, 0, klen + 3);
|
||||
px_memset(secmsg, 0, klen + 3);
|
||||
px_free(secmsg);
|
||||
|
||||
if (res >= 0)
|
||||
|
Reference in New Issue
Block a user