Reject setting invalid CSR versions

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23965)
This commit is contained in:
Job Snijders 2024-03-25 10:49:12 +00:00 committed by Neil Horman
parent e582b2b22b
commit 397051a40d

View File

@ -17,8 +17,10 @@
int X509_REQ_set_version(X509_REQ *x, long version)
{
if (x == NULL)
if (x == NULL || version != X509_REQ_VERSION_1) {
ERR_raise(ERR_LIB_X509, ERR_R_PASSED_INVALID_ARGUMENT);
return 0;
}
x->req_info.enc.modified = 1;
return ASN1_INTEGER_set(x->req_info.version, version);
}