make explicit_bzero/memset safe for sz=0
This commit is contained in:
parent
8433d51e06
commit
738c73dca2
|
@ -20,6 +20,8 @@
|
||||||
void
|
void
|
||||||
explicit_bzero(void *p, size_t n)
|
explicit_bzero(void *p, size_t n)
|
||||||
{
|
{
|
||||||
|
if (n == 0)
|
||||||
|
return;
|
||||||
(void)memset_s(p, n, 0, n);
|
(void)memset_s(p, n, 0, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +36,8 @@ static void (* volatile ssh_bzero)(void *, size_t) = bzero;
|
||||||
void
|
void
|
||||||
explicit_bzero(void *p, size_t n)
|
explicit_bzero(void *p, size_t n)
|
||||||
{
|
{
|
||||||
|
if (n == 0)
|
||||||
|
return;
|
||||||
/*
|
/*
|
||||||
* clang -fsanitize=memory needs to intercept memset-like functions
|
* clang -fsanitize=memory needs to intercept memset-like functions
|
||||||
* to correctly detect memory initialisation. Make sure one is called
|
* to correctly detect memory initialisation. Make sure one is called
|
||||||
|
|
Loading…
Reference in New Issue