]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix Coverity 1201740 & 1201712: uninitialised values
authorPauli <pauli@openssl.org>
Wed, 16 Mar 2022 03:30:03 +0000 (14:30 +1100)
committerPauli <pauli@openssl.org>
Sun, 8 May 2022 07:50:04 +0000 (17:50 +1000)
These are both false positives since the `d` array is initialised by
the `DES_cfb_encrypt()` call via the `l2cn` macro.  Rather than ignoring them
and having them crop up later, it's easier to just add an initialiser.

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/17894)

crypto/evp/e_des.c
crypto/evp/e_des3.c

index cd6e5af8d0e41ac89259951b245c9fb8eea8d0fe..6eb49c0339102c2df3206533ee41aaedb5b10c60 100644 (file)
@@ -149,7 +149,8 @@ static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                            const unsigned char *in, size_t inl)
 {
     size_t n, chunk = EVP_MAXCHUNK / 8;
-    unsigned char c[1], d[1];
+    unsigned char c[1];
+    unsigned char d[1] = { 0 };  /* Appease Coverity */
 
     if (inl < chunk)
         chunk = inl;
index 1e1591834402ca1b8e6891fa926cea7018dc9358..c0bc7fdd8ffbc920e777de7dbf4305e40877f742 100644 (file)
@@ -165,7 +165,8 @@ static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                                 const unsigned char *in, size_t inl)
 {
     size_t n;
-    unsigned char c[1], d[1];
+    unsigned char c[1];
+    unsigned char d[1] = { 0 }; /* Appease Coverity */
 
     if (!EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
             inl *= 8;