diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-05-04 08:35:35 +0200 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-05-04 08:35:35 +0200 |
commit | 3279ad79c3dcecbb2c5c001775d7a28f982e0955 (patch) | |
tree | 2511b58f7b1b50fc0b9b84efa1c29fe25bd7876b /drivers/builtin_openssl2/crypto/pem/pvkfmt.c | |
parent | 6a4b62e72069f7c96f8b7cb9b7855da0bbd84b63 (diff) | |
parent | ab623c923d4e2c950342aec5da371cb92b1fbbc6 (diff) |
Merge pull request #4540 from mrezai/openssl-1.0.2h
Update OpenSSL to 1.0.2h
Diffstat (limited to 'drivers/builtin_openssl2/crypto/pem/pvkfmt.c')
-rw-r--r-- | drivers/builtin_openssl2/crypto/pem/pvkfmt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/builtin_openssl2/crypto/pem/pvkfmt.c b/drivers/builtin_openssl2/crypto/pem/pvkfmt.c index 82d45273ed..61864468f6 100644 --- a/drivers/builtin_openssl2/crypto/pem/pvkfmt.c +++ b/drivers/builtin_openssl2/crypto/pem/pvkfmt.c @@ -131,6 +131,10 @@ static int read_lebn(const unsigned char **in, unsigned int nbyte, BIGNUM **r) # define MS_PVKMAGIC 0xb0b5f11eL /* Salt length for PVK files */ # define PVK_SALTLEN 0x10 +/* Maximum length in PVK header */ +# define PVK_MAX_KEYLEN 102400 +/* Maximum salt length */ +# define PVK_MAX_SALTLEN 10240 static EVP_PKEY *b2i_rsa(const unsigned char **in, unsigned int length, unsigned int bitlen, int ispub); @@ -644,6 +648,9 @@ static int do_PVK_header(const unsigned char **in, unsigned int length, *psaltlen = read_ledword(&p); *pkeylen = read_ledword(&p); + if (*pkeylen > PVK_MAX_KEYLEN || *psaltlen > PVK_MAX_SALTLEN) + return 0; + if (is_encrypted && !*psaltlen) { PEMerr(PEM_F_DO_PVK_HEADER, PEM_R_INCONSISTENT_HEADER); return 0; |