aboutsummaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/mbuf.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2014-04-17 12:37:53 -0400
committerBruce Momjian <bruce@momjian.us>2014-04-17 12:37:53 -0400
commitfc02b87e2876b2492a3d5eebd3b70be383b08f40 (patch)
tree19301491c363e8f87b15d53f1f742b5975161749 /contrib/pgcrypto/mbuf.c
parent179c45ae2fb9519a343bc2e38ebe4609097d14af (diff)
downloadpostgresql-fc02b87e2876b2492a3d5eebd3b70be383b08f40.tar.gz
postgresql-fc02b87e2876b2492a3d5eebd3b70be383b08f40.zip
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/mbuf.c')
-rw-r--r--contrib/pgcrypto/mbuf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/pgcrypto/mbuf.c b/contrib/pgcrypto/mbuf.c
index 6246900c7ae..5980cb0e002 100644
--- a/contrib/pgcrypto/mbuf.c
+++ b/contrib/pgcrypto/mbuf.c
@@ -69,7 +69,7 @@ mbuf_free(MBuf *mbuf)
{
if (mbuf->own_data)
{
- memset(mbuf->data, 0, mbuf->buf_end - mbuf->data);
+ px_memset(mbuf->data, 0, mbuf->buf_end - mbuf->data);
px_free(mbuf->data);
}
px_free(mbuf);
@@ -249,11 +249,11 @@ pullf_free(PullFilter *pf)
if (pf->buf)
{
- memset(pf->buf, 0, pf->buflen);
+ px_memset(pf->buf, 0, pf->buflen);
px_free(pf->buf);
}
- memset(pf, 0, sizeof(*pf));
+ px_memset(pf, 0, sizeof(*pf));
px_free(pf);
}
@@ -298,7 +298,7 @@ pullf_read_max(PullFilter *pf, int len, uint8 **data_p, uint8 *tmpbuf)
if (res < 0)
{
/* so the caller must clear only on success */
- memset(tmpbuf, 0, total);
+ px_memset(tmpbuf, 0, total);
return res;
}
if (res == 0)
@@ -415,11 +415,11 @@ pushf_free(PushFilter *mp)
if (mp->buf)
{
- memset(mp->buf, 0, mp->block_size);
+ px_memset(mp->buf, 0, mp->block_size);
px_free(mp->buf);
}
- memset(mp, 0, sizeof(*mp));
+ px_memset(mp, 0, sizeof(*mp));
px_free(mp);
}