From 0c92628340ea7b6e22c2a6b61e7dfb91f82879d5 Mon Sep 17 00:00:00 2001 From: Jennifer Sutton Date: Mon, 26 May 2025 12:00:16 +1200 Subject: [PATCH] =?utf8?q?lib:crypto:=20Don=E2=80=99t=20pass=20null=20poin?= =?utf8?q?ter=20to=20memcpy()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This results in undefined behaviour. Signed-off-by: Jennifer Sutton Reviewed-by: Douglas Bagnall --- lib/crypto/md4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) { -- 2.47.3