From ba19bca9158ce84093f3b3d9ef5856fd7c95bd73 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sun, 1 Jun 2014 05:12:50 +0000 Subject: Avoid the use of an uninitialised variable. In reality, this is a non-issue since the calculated value is not actually used in the uninitialised case. Change the code so that we only do the calculation if we actually need it. Issue detected by clang and reported by both brad@ and Brent Cook. --- src/lib/libcrypto/pem/pem_lib.c | 3 +-- src/lib/libssl/src/crypto/pem/pem_lib.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index 945262f019..5938330d45 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c @@ -465,12 +465,11 @@ PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen, EVP_CIPHER_CTX_cleanup(&ctx); OPENSSL_cleanse((char *)buf, sizeof(buf)); OPENSSL_cleanse((char *)key, sizeof(key)); - j += i; if (!o) { PEMerr(PEM_F_PEM_DO_HEADER, PEM_R_BAD_DECRYPT); return (0); } - *plen = j; + *plen = j + i; return (1); } diff --git a/src/lib/libssl/src/crypto/pem/pem_lib.c b/src/lib/libssl/src/crypto/pem/pem_lib.c index 945262f019..5938330d45 100644 --- a/src/lib/libssl/src/crypto/pem/pem_lib.c +++ b/src/lib/libssl/src/crypto/pem/pem_lib.c @@ -465,12 +465,11 @@ PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen, EVP_CIPHER_CTX_cleanup(&ctx); OPENSSL_cleanse((char *)buf, sizeof(buf)); OPENSSL_cleanse((char *)key, sizeof(key)); - j += i; if (!o) { PEMerr(PEM_F_PEM_DO_HEADER, PEM_R_BAD_DECRYPT); return (0); } - *plen = j; + *plen = j + i; return (1); } -- cgit v1.2.3-55-g6feb