1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-20 02:42:09 +03:00

Fix conditional check for HAVE_DECL_SECUREZEROMEMORY

"Unlike the other `AC_CHECK_*S' macros, when a symbol is not declared,
HAVE_DECL_symbol is defined to `0' instead of leaving HAVE_DECL_symbol
undeclared. When you are sure that the check was performed,
use HAVE_DECL_symbol in #if."

Source: autoconf documentation for AC_CHECK_DECLS.
This commit is contained in:
Marc Hoersken
2018-09-02 17:49:28 +02:00
parent ee89d17d67
commit 8b870ad771

View File

@@ -53,9 +53,11 @@
#include <sys/time.h>
#endif
#ifdef HAVE_DECL_SECUREZEROMEMORY
#if defined(HAVE_DECL_SECUREZEROMEMORY) && HAVE_DECL_SECUREZEROMEMORY
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#endif
#include <stdio.h>
#include <errno.h>
@@ -689,7 +691,7 @@ static void * (* const volatile memset_libssh)(void *, int, size_t) = memset;
void _libssh2_explicit_zero(void *buf, size_t size)
{
#ifdef HAVE_DECL_SECUREZEROMEMORY
#if defined(HAVE_DECL_SECUREZEROMEMORY) && HAVE_DECL_SECUREZEROMEMORY
SecureZeroMemory(buf, size);
#elif defined(HAVE_MEMSET_S)
(void)memset_s(buf, size, 0, size);