diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-19 05:50:11 +0100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-04-08 00:49:27 +0200 |
commit | 48b05bb617e247a40b66c2ddd9326966000a3504 (patch) | |
tree | 738790676e6252830de0b0a5829d74f0d3c2b4b0 /crypto/evp | |
parent | evp: fix coverity 1472682: argument cannot be negative (diff) | |
download | openssl-48b05bb617e247a40b66c2ddd9326966000a3504.tar.xz openssl-48b05bb617e247a40b66c2ddd9326966000a3504.zip |
evp: fix coverity 1451510: argument cannot be negative
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14620)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/e_rc4.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/evp/e_rc4.c b/crypto/evp/e_rc4.c index 10b83aea6d..94107c72c3 100644 --- a/crypto/evp/e_rc4.c +++ b/crypto/evp/e_rc4.c @@ -75,7 +75,11 @@ const EVP_CIPHER *EVP_rc4_40(void) static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { - RC4_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), key); + int keylen; + + if ((keylen = EVP_CIPHER_CTX_key_length(ctx)) <= 0) + return 0; + RC4_set_key(&data(ctx)->ks, keylen, key); return 1; } |