]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib:crypto: Don’t pass null pointer to memcpy()
authorJennifer Sutton <jennifersutton@catalyst.net.nz>
Mon, 26 May 2025 00:00:16 +0000 (12:00 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 27 Aug 2025 03:41:36 +0000 (03:41 +0000)
This results in undefined behaviour.

Signed-off-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
lib/crypto/md4.c

index 4014aa750b3b4a26111d535e05c3b656c9729856..d71a14eb37e98311234330fab0cb02cbdd1c5c3b 100644 (file)
@@ -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) {