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:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user