summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pem/pem_lib.c
diff options
context:
space:
mode:
authorjsing <>2014-06-01 05:12:50 +0000
committerjsing <>2014-06-01 05:12:50 +0000
commite356b447e74b757810a71e2bf8e431b22fd6e328 (patch)
treef05656897aa8e537052b576e969c13f51fc89c35 /src/lib/libcrypto/pem/pem_lib.c
parent87dd2c0df712a3de91371f86a8b291e4fc65fa05 (diff)
downloadopenbsd-e356b447e74b757810a71e2bf8e431b22fd6e328.tar.gz
openbsd-e356b447e74b757810a71e2bf8e431b22fd6e328.tar.bz2
openbsd-e356b447e74b757810a71e2bf8e431b22fd6e328.zip
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 'src/lib/libcrypto/pem/pem_lib.c')
-rw-r--r--src/lib/libcrypto/pem/pem_lib.c3
1 files changed, 1 insertions, 2 deletions
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,
465 EVP_CIPHER_CTX_cleanup(&ctx); 465 EVP_CIPHER_CTX_cleanup(&ctx);
466 OPENSSL_cleanse((char *)buf, sizeof(buf)); 466 OPENSSL_cleanse((char *)buf, sizeof(buf));
467 OPENSSL_cleanse((char *)key, sizeof(key)); 467 OPENSSL_cleanse((char *)key, sizeof(key));
468 j += i;
469 if (!o) { 468 if (!o) {
470 PEMerr(PEM_F_PEM_DO_HEADER, PEM_R_BAD_DECRYPT); 469 PEMerr(PEM_F_PEM_DO_HEADER, PEM_R_BAD_DECRYPT);
471 return (0); 470 return (0);
472 } 471 }
473 *plen = j; 472 *plen = j + i;
474 return (1); 473 return (1);
475} 474}
476 475