summaryrefslogtreecommitdiffstats
path: root/apps/enc.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2016-05-09 18:42:58 +0200
committerRich Salz <rsalz@openssl.org>2016-07-20 01:35:38 -0400
commitf6c460e8f69e90fdb87129bb70951ced89c7906f (patch)
tree63966a5b1ea5339f1f81f19d0eae5f484c6987d7 /apps/enc.c
parentcdd202f2546f301d128a547d77b27fb4321d249b (diff)
Fix double calls to strlen
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1284)
Diffstat (limited to 'apps/enc.c')
-rw-r--r--apps/enc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/enc.c b/apps/enc.c
index 403d14e800..10ab15af27 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -382,6 +382,8 @@ int enc_main(int argc, char **argv)
* output BIO. If decrypting read salt from input BIO.
*/
unsigned char *sptr;
+ size_t str_len = strlen(str);
+
if (nosalt)
sptr = NULL;
else {
@@ -421,7 +423,7 @@ int enc_main(int argc, char **argv)
if (!EVP_BytesToKey(cipher, dgst, sptr,
(unsigned char *)str,
- strlen(str), 1, key, iv)) {
+ str_len, 1, key, iv)) {
BIO_printf(bio_err, "EVP_BytesToKey failed\n");
goto end;
}
@@ -432,7 +434,7 @@ int enc_main(int argc, char **argv)
if (str == strbuf)
OPENSSL_cleanse(str, SIZE);
else
- OPENSSL_cleanse(str, strlen(str));
+ OPENSSL_cleanse(str, str_len);
}
if (hiv != NULL) {
int siz = EVP_CIPHER_iv_length(cipher);