summaryrefslogtreecommitdiffstats
path: root/thirdparty/mbedtls/library/cipher.c
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/mbedtls/library/cipher.c')
-rw-r--r--thirdparty/mbedtls/library/cipher.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/thirdparty/mbedtls/library/cipher.c b/thirdparty/mbedtls/library/cipher.c
index 0683677eda..7f4c121492 100644
--- a/thirdparty/mbedtls/library/cipher.c
+++ b/thirdparty/mbedtls/library/cipher.c
@@ -849,6 +849,9 @@ static int get_pkcs_padding(unsigned char *input, size_t input_len,
}
padding_len = input[input_len - 1];
+ if (padding_len == 0 || padding_len > input_len) {
+ return MBEDTLS_ERR_CIPHER_INVALID_PADDING;
+ }
*data_len = input_len - padding_len;
mbedtls_ct_condition_t bad = mbedtls_ct_uint_gt(padding_len, input_len);