summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-06-01 05:12:50 +0000
committerjsing <jsing@openbsd.org>2014-06-01 05:12:50 +0000
commit4dca89cc1d3774310a231c5de8a4dbe5711d8075 (patch)
treeed9f65d009344c499270af5ac74a22b47764ebb8
parentEBCDIC support died a while ago, except in a comment. (diff)
downloadwireguard-openbsd-4dca89cc1d3774310a231c5de8a4dbe5711d8075.tar.xz
wireguard-openbsd-4dca89cc1d3774310a231c5de8a4dbe5711d8075.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.
-rw-r--r--lib/libcrypto/pem/pem_lib.c3
-rw-r--r--lib/libssl/src/crypto/pem/pem_lib.c3
2 files changed, 2 insertions, 4 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);
}
diff --git a/lib/libssl/src/crypto/pem/pem_lib.c b/lib/libssl/src/crypto/pem/pem_lib.c
index 945262f0199..5938330d453 100644
--- a/lib/libssl/src/crypto/pem/pem_lib.c
+++ b/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);
}