summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/px.c
diff options
context:
space:
mode:
authorBruce Momjian2014-04-17 16:37:53 +0000
committerBruce Momjian2014-04-17 16:37:53 +0000
commit9fe55259fd61fd9199907623f974caa7af66e780 (patch)
tree2d2d7fc333474267d375ca35db482b8a4e42e253 /contrib/pgcrypto/px.c
parent83defef8c794e7772e4099a7efa2ebac3c62742c (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/px.c')
-rw-r--r--contrib/pgcrypto/px.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/pgcrypto/px.c b/contrib/pgcrypto/px.c
index f23d4de5738..4b2a1207f9d 100644
--- a/contrib/pgcrypto/px.c
+++ b/contrib/pgcrypto/px.c
@@ -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);
}