From e7270aa99d7effb85ac763de3cedad64ecb85267 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Fri, 6 Jan 2017 16:22:59 -0500 Subject: [PATCH] Fix bad attempt at refactoring --- toxcore/crypto_core_mem.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/toxcore/crypto_core_mem.c b/toxcore/crypto_core_mem.c index 8d469986..0f199794 100644 --- a/toxcore/crypto_core_mem.c +++ b/toxcore/crypto_core_mem.c @@ -37,13 +37,15 @@ void crypto_memzero(void *data, size_t length) sodium_memzero(data, length); #else #ifdef _WIN32 - SecureZeroMemory(pnt, len); + SecureZeroMemory(data, length); #elif defined(HAVE_MEMSET_S) - errno_t code = memset_s(data, (rsize_t) length, 0, (rsize_t) length) + if (length > 0U) { + errno_t code = memset_s(data, (rsize_t) length, 0, (rsize_t) length); - if (len > 0U && code != 0) { - abort(); /* LCOV_EXCL_LINE */ + if (code != 0) { + abort(); /* LCOV_EXCL_LINE */ + } } #elif defined(HAVE_EXPLICIT_BZERO)