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:54:23 +0000 |
commit | c62e94d805fa2900a0d6d723715aaf45f75b6c14 (patch) | |
tree | 8141d572c1e54ec31e09cf15fdd6f2a99dd656df | |
parent | b352160f816585d2be1bcd8862efae647968f406 (diff) |
Fix HMAC to pass invalid key len test
Reviewed-by: Richard Levitte <levitte@openssl.org>
-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 f1fdba42d8..8ee5b2ac19 100644 --- a/crypto/hmac/hmac.c +++ b/crypto/hmac/hmac.c @@ -93,7 +93,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; } |