]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Or just set inlen correctly when in is NULL
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Apr 2021 20:23:03 +0000 (15:23 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Apr 2021 20:23:03 +0000 (15:23 -0500)
src/lib/util/md5.c

index 31180ce52fe3270998338f1eccb4e8e13e757c6f..0b9488b7cf339e06367f9abd136324982d085fe5 100644 (file)
@@ -461,7 +461,10 @@ static void fr_md5_local_update(fr_md5_ctx_t *ctx, uint8_t const *in, size_t inl
         *      ubsan doesn't like arithmetic on
         *      NULL pointers.
         */
-       if (!in) in = (uint8_t[MD5_BLOCK_LENGTH]){ 0x00 };
+       if (!in) {
+               in = (uint8_t[]){ 0x00 };
+               inlen = 0;
+       }
 
        /* Check how many bytes we already have and how many more we need. */
        have = (size_t)((ctx_local->count[0] >> 3) & (MD5_BLOCK_LENGTH - 1));