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)