summaryrefslogtreecommitdiff
path: root/lib/libcrypto/pem
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2014-06-01 05:12:51 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2014-06-01 05:12:51 +0000
commit5a91abe85b1a52543024d9443761b844d13ba8dd (patch)
tree5cc5fc3c075111244e6216849784a631b9b46f48 /lib/libcrypto/pem
parentca6a993950deb92f0117a876b851ef73fb163521 (diff)
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.
Diffstat (limited to 'lib/libcrypto/pem')
-rw-r--r--lib/libcrypto/pem/pem_lib.c3
1 files changed, 1 insertions, 2 deletions
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);
}