From: Alan T. DeKok Date: Mon, 11 Apr 2022 23:56:39 +0000 (-0400) Subject: don't use variable out of scope. CID #1503994 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9738097734a07f6672be588cccefaa1783bb11eb;p=thirdparty%2Ffreeradius-server.git don't use variable out of scope. CID #1503994 --- diff --git a/src/lib/util/md4.c b/src/lib/util/md4.c index 3eb8f1f1cff..b5564f72eb4 100644 --- a/src/lib/util/md4.c +++ b/src/lib/util/md4.c @@ -362,6 +362,8 @@ static void fr_md4_local_ctx_free(fr_md4_ctx_t **ctx) *ctx = NULL; } +static const uint8_t *zero = (uint8_t[]){ 0x00 }; + /** @copydoc fr_md4_update * */ @@ -377,7 +379,7 @@ static void fr_md4_local_update(fr_md4_ctx_t *ctx, uint8_t const *in, size_t inl * NULL pointers. */ if (!in) { - in = (uint8_t[]){ 0x00 }; + in = zero; inlen = 0; } diff --git a/src/lib/util/md5.c b/src/lib/util/md5.c index e7434a20e53..c3c60049cd3 100644 --- a/src/lib/util/md5.c +++ b/src/lib/util/md5.c @@ -357,6 +357,8 @@ static void fr_md5_local_ctx_free(fr_md5_ctx_t **ctx) *ctx = NULL; } +static const uint8_t *zero = (uint8_t[]){ 0x00 }; + /** @copydoc fr_md5_update * */ @@ -373,7 +375,7 @@ static void fr_md5_local_update(fr_md5_ctx_t *ctx, uint8_t const *in, size_t inl * NULL pointers. */ if (!in) { - in = (uint8_t[]){ 0x00 }; + in = zero; inlen = 0; }