diff options
author | Matt Caswell <matt@openssl.org> | 2015-02-10 13:15:25 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-03-25 12:58:56 +0000 |
commit | ddbf312fb4ae31eb2e87af736e0a3b5b347d736a (patch) | |
tree | 031a22f011a3070501c909732903aef42d50d23f /crypto/hmac | |
parent | e7c2ad508d50144bc0ba480c75a2ee3367e98ee4 (diff) |
Fix HMAC to pass invalid key len test
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/hmac')
-rw-r--r-- | crypto/hmac/hmac.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c index 31d08ef881..0eea5626e6 100644 --- a/crypto/hmac/hmac.c +++ b/crypto/hmac/hmac.c @@ -123,7 +123,8 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, &ctx->key_length)) goto err; } else { - OPENSSL_assert(len >= 0 && len <= (int)sizeof(ctx->key)); + if(len < 0 || len > (int)sizeof(ctx->key)) + return 0; memcpy(ctx->key, key, len); ctx->key_length = len; } |