aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/keccak.c
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-04-29 08:17:32 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-06-14 08:47:29 +0000
commit0564da5fdc165948ba7c862fb81478f9287a072d (patch)
tree3a30a0c1ec0c5a8d8fa73b950c7251aa219d1e09 /src/crypto/keccak.c
parentabstract_tcp_server2: improve DoS resistance (diff)
downloadmonero-0564da5fdc165948ba7c862fb81478f9287a072d.tar.xz
ensure no NULL is passed to memcpy
NULL is valid when size is 0, but memcpy uses nonnull attributes, so let's not poke the bear
Diffstat (limited to 'src/crypto/keccak.c')
-rw-r--r--src/crypto/keccak.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crypto/keccak.c b/src/crypto/keccak.c
index 170911262..18ed3152f 100644
--- a/src/crypto/keccak.c
+++ b/src/crypto/keccak.c
@@ -116,7 +116,8 @@ void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen)
local_abort("Bad keccak use");
}
- memcpy(temp, in, inlen);
+ if (inlen > 0)
+ memcpy(temp, in, inlen);
temp[inlen++] = 1;
memset(temp + inlen, 0, rsiz - inlen);
temp[rsiz - 1] |= 0x80;