Message ID | 20171127071620.25724-1-ebiggers3@gmail.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Herbert Xu |
Headers | show |
On Sun, 26 Nov 2017, Eric Biggers wrote: > Fixes: 42d5ec27f873 ("X.509: Add an ASN.1 decoder") > Cc: <stable@vger.kernel.org> # v3.7+ > Signed-off-by: Eric Biggers <ebiggers@google.com> > --- > crypto/asymmetric_keys/x509_cert_parser.c | 2 ++ > 1 file changed, 2 insertions(+) Reviewed-by: James Morris <james.l.morris@oracle.com>
diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c index dd03fead1ca3..ce2df8c9c583 100644 --- a/crypto/asymmetric_keys/x509_cert_parser.c +++ b/crypto/asymmetric_keys/x509_cert_parser.c @@ -409,6 +409,8 @@ int x509_extract_key_data(void *context, size_t hdrlen, ctx->cert->pub->pkey_algo = "rsa"; /* Discard the BIT STRING metadata */ + if (vlen < 1 || *(const u8 *)value != 0) + return -EBADMSG; ctx->key = value + 1; ctx->key_size = vlen - 1; return 0;