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:
@ -104,6 +104,12 @@ px_strerror(int err)
|
||||
return "Bad error code";
|
||||
}
|
||||
|
||||
/* memset that must not be optimized away */
|
||||
void
|
||||
px_memset(void *ptr, int c, size_t len)
|
||||
{
|
||||
memset(ptr, c, len);
|
||||
}
|
||||
|
||||
const char *
|
||||
px_resolve_alias(const PX_Alias *list, const char *name)
|
||||
@ -327,7 +333,7 @@ combo_free(PX_Combo *cx)
|
||||
{
|
||||
if (cx->cipher)
|
||||
px_cipher_free(cx->cipher);
|
||||
memset(cx, 0, sizeof(*cx));
|
||||
px_memset(cx, 0, sizeof(*cx));
|
||||
px_free(cx);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user