From: Dr. Stephen Henson Date: Sat, 5 Jul 2014 23:32:44 +0000 (+0100) Subject: Sanity check keylength in PVK files. X-Git-Tag: master-post-reformat~601 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=5ecf1141a51ef862b498de6fa23244a47b547c47 Sanity check keylength in PVK files. PR#2277 --- diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c index b1bf71a5da..ae89f8281a 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -759,6 +759,11 @@ static EVP_PKEY *do_PVK_body(const unsigned char **in, /* Copy BLOBHEADER across, decrypt rest */ memcpy(enctmp, p, 8); p += 8; + if (keylen < 8) + { + PEMerr(PEM_F_DO_PVK_BODY, PEM_R_PVK_TOO_SHORT); + return NULL; + } inlen = keylen - 8; q = enctmp + 8; if (!EVP_DecryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, NULL))