From: Matt Caswell Date: Tue, 10 Feb 2015 13:15:25 +0000 (+0000) Subject: Fix HMAC to pass invalid key len test X-Git-Tag: OpenSSL_1_0_1n~110 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=42c9c7103c8e7fd73dafa0500120f8e34fd659c3 Fix HMAC to pass invalid key len test Reviewed-by: Richard Levitte --- diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c index 6567648acc..2daacf6e70 100644 --- a/crypto/hmac/hmac.c +++ b/crypto/hmac/hmac.c @@ -113,7 +113,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; }