diff options
author | luigi1111 <luigi1111w@gmail.com> | 2018-07-27 14:29:55 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2018-07-27 14:29:55 -0500 |
commit | 21b1fa1c358a4ceef2345807ec1769acc39f3a3a (patch) | |
tree | ee94423193613a1f3985f795ec89f3145d353205 | |
parent | Merge pull request #4110 (diff) | |
parent | memwipe: don't call the workhorse for 0 bytes (diff) | |
download | monero-21b1fa1c358a4ceef2345807ec1769acc39f3a3a.tar.xz |
Merge pull request #4126
8d578f1 memwipe: don't call the workhorse for 0 bytes (moneromooo-monero)
-rw-r--r-- | contrib/epee/src/memwipe.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/epee/src/memwipe.c b/contrib/epee/src/memwipe.c index e3a2f76c8..c2a26c392 100644 --- a/contrib/epee/src/memwipe.c +++ b/contrib/epee/src/memwipe.c @@ -50,7 +50,7 @@ void *memwipe(void *ptr, size_t n) { - if (memset_s(ptr, n, 0, n)) + if (n > 0 && memset_s(ptr, n, 0, n)) { #ifdef NDEBUG fprintf(stderr, "Error: memset_s failed\n"); @@ -67,7 +67,8 @@ void *memwipe(void *ptr, size_t n) void *memwipe(void *ptr, size_t n) { - explicit_bzero(ptr, n); + if (n > 0) + explicit_bzero(ptr, n); SCARECROW return ptr; } @@ -105,7 +106,8 @@ static void memory_cleanse(void *ptr, size_t len) void *memwipe(void *ptr, size_t n) { - memory_cleanse(ptr, n); + if (n > 0) + memory_cleanse(ptr, n); SCARECROW return ptr; } |