summaryrefslogtreecommitdiff
path: root/openbsd-compat/explicit_bzero.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/explicit_bzero.c')
-rw-r--r--openbsd-compat/explicit_bzero.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/openbsd-compat/explicit_bzero.c b/openbsd-compat/explicit_bzero.c
index 5078134d1..53a003472 100644
--- a/openbsd-compat/explicit_bzero.c
+++ b/openbsd-compat/explicit_bzero.c
@@ -20,6 +20,8 @@
20void 20void
21explicit_bzero(void *p, size_t n) 21explicit_bzero(void *p, size_t n)
22{ 22{
23 if (n == 0)
24 return;
23 (void)memset_s(p, n, 0, n); 25 (void)memset_s(p, n, 0, n);
24} 26}
25 27
@@ -34,6 +36,8 @@ static void (* volatile ssh_bzero)(void *, size_t) = bzero;
34void 36void
35explicit_bzero(void *p, size_t n) 37explicit_bzero(void *p, size_t n)
36{ 38{
39 if (n == 0)
40 return;
37 /* 41 /*
38 * clang -fsanitize=memory needs to intercept memset-like functions 42 * clang -fsanitize=memory needs to intercept memset-like functions
39 * to correctly detect memory initialisation. Make sure one is called 43 * to correctly detect memory initialisation. Make sure one is called