From: Jennifer Sutton Date: Mon, 26 May 2025 00:00:16 +0000 (+1200) Subject: lib:crypto: Don’t pass null pointer to memcpy() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c92628340ea7b6e22c2a6b61e7dfb91f82879d5;p=thirdparty%2Fsamba.git lib:crypto: Don’t pass null pointer to memcpy() This results in undefined behaviour. Signed-off-by: Jennifer Sutton Reviewed-by: Douglas Bagnall --- diff --git a/lib/crypto/md4.c b/lib/crypto/md4.c index 4014aa750b3..d71a14eb37e 100644 --- a/lib/crypto/md4.c +++ b/lib/crypto/md4.c @@ -151,7 +151,9 @@ _PUBLIC_ void mdfour(uint8_t *out, const uint8_t *in, int n) for (i=0;i<128;i++) buf[i] = 0; - memcpy(buf, in, n); + if (in != NULL) { + memcpy(buf, in, n); + } buf[n] = 0x80; if (n <= 55) {