summaryrefslogtreecommitdiffhomepage
path: root/dbutil.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2016-03-16 23:39:39 +0800
committerMatt Johnston <matt@ucc.asn.au>2016-03-16 23:39:39 +0800
commitb647b753e005588065f806f9830928a9b53cdcef (patch)
tree594fc4194d00744125829ca92e512763fefebb2a /dbutil.c
parent48b855c581db62e4b39ac88cb69d4abf79504ee2 (diff)
Use memset_s or explicit_bzero
Diffstat (limited to 'dbutil.c')
-rw-r--r--dbutil.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dbutil.c b/dbutil.c
index 93b03a3..27f0fd1 100644
--- a/dbutil.c
+++ b/dbutil.c
@@ -564,6 +564,12 @@ void * m_realloc(void* ptr, size_t size) {
/* Beware of calling this from within dbutil.c - things might get
* optimised away */
void m_burn(void *data, unsigned int len) {
+
+#if defined(HAVE_MEMSET_S)
+ memset_s(data, len, 0x0, len);
+#elif defined(HAVE_EXPLICIT_BZERO)
+ explicit_bzero(data, len);
+#else
volatile char *p = data;
if (data == NULL)
@@ -571,6 +577,7 @@ void m_burn(void *data, unsigned int len) {
while (len--) {
*p++ = 0x0;
}
+#endif
}