summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 5078134d..53a00347 100644
--- a/openbsd-compat/explicit_bzero.c
+++ b/openbsd-compat/explicit_bzero.c
@@ -20,6 +20,8 @@
void
explicit_bzero(void *p, size_t n)
{
+ if (n == 0)
+ return;
(void)memset_s(p, n, 0, n);
}
@@ -34,6 +36,8 @@ static void (* volatile ssh_bzero)(void *, size_t) = bzero;
void
explicit_bzero(void *p, size_t n)
{
+ if (n == 0)
+ return;
/*
* clang -fsanitize=memory needs to intercept memset-like functions
* to correctly detect memory initialisation. Make sure one is called