From 4ed7376a5dec59995e1294780ecdc2b29f0815a1 Mon Sep 17 00:00:00 2001 From: Janos Follath Date: Mon, 8 Feb 2016 13:59:25 +0000 Subject: [PATCH] Length check added --- library/rsa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/rsa.c b/library/rsa.c index 0cb0e7d8d..aa7e2723b 100644 --- a/library/rsa.c +++ b/library/rsa.c @@ -844,6 +844,9 @@ int rsa_rsaes_pkcs1_v15_decrypt( rsa_context *ctx, bad |= *p++; /* Must be zero */ } + if( pad_count < 8 ) + return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); + if( bad ) return( POLARSSL_ERR_RSA_INVALID_PADDING );