]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Avoid use of an uninitialized array
authorMeng Yuan <quic_menyua@quicinc.com>
Wed, 16 Apr 2025 06:51:21 +0000 (14:51 +0800)
committerJouni Malinen <j@w1.fi>
Fri, 25 Apr 2025 20:22:13 +0000 (23:22 +0300)
Initialize the skip_buf[] array before using it with EVP_CipherUpdate()
to skip the initial segment of RC4 output. This does not change actual
behavior since the output of that call is not used and it is only there
for changing the internal state of the RC4 cipher. However, this avoids
uninitialized element issues reported in MISRA.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/crypto/crypto_openssl.c

index c84ccb466f50da3b767b7778654f723dec5d0c51..2efe3ed942187197dcc00b343ee8ed254f924087 100644 (file)
@@ -431,7 +431,7 @@ int rc4_skip(const u8 *key, size_t keylen, size_t skip,
        EVP_CIPHER_CTX *ctx;
        int outl;
        int res = -1;
-       unsigned char skip_buf[16];
+       unsigned char skip_buf[16] = { 0 };
 
        openssl_load_legacy_provider();