From 5a91abe85b1a52543024d9443761b844d13ba8dd Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sun, 1 Jun 2014 05:12:51 +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. --- lib/libcrypto/pem/pem_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libcrypto/pem/pem_lib.c b/lib/libcrypto/pem/pem_lib.c index 945262f0199..5938330d453 100644 --- a/lib/libcrypto/pem/pem_lib.c +++ b/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); } -- cgit v1.2.3