mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
misc: Use memset_s if available for explicit_bzero
Useful on OSX where memset_s is available. Signed-off-by: Alberto Aguirre <albaguirre@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
dd20253fec
commit
3fa0e3959c
@@ -1055,11 +1055,15 @@ int ssh_match_group(const char *group, const char *object)
|
||||
#if !defined(HAVE_EXPLICIT_BZERO)
|
||||
void explicit_bzero(void *s, size_t n)
|
||||
{
|
||||
#if defined(HAVE_MEMSET_S)
|
||||
memset_s(s, n, '\0', n);
|
||||
#else
|
||||
memset(s, '\0', n);
|
||||
#if defined(HAVE_GCC_VOLATILE_MEMORY_PROTECTION)
|
||||
/* See http://llvm.org/bugs/show_bug.cgi?id=15495 */
|
||||
__asm__ volatile("" : : "g"(s) : "memory");
|
||||
#endif /* HAVE_GCC_VOLATILE_MEMORY_PROTECTION */
|
||||
#endif
|
||||
}
|
||||
#endif /* !HAVE_EXPLICIT_BZERO */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user