summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_set.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/x509/x509_set.c')
-rw-r--r--src/lib/libcrypto/x509/x509_set.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/libcrypto/x509/x509_set.c b/src/lib/libcrypto/x509/x509_set.c
index b56d30aec5..684a899781 100644
--- a/src/lib/libcrypto/x509/x509_set.c
+++ b/src/lib/libcrypto/x509/x509_set.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_set.c,v 1.26 2023/06/23 08:00:28 tb Exp $ */ 1/* $OpenBSD: x509_set.c,v 1.27 2024/03/26 11:09:37 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -84,6 +84,12 @@ X509_set_version(X509 *x, long version)
84{ 84{
85 if (x == NULL) 85 if (x == NULL)
86 return (0); 86 return (0);
87 /*
88 * RFC 5280, 4.1: versions 1 - 3 are specified as follows.
89 * Version ::= INTEGER { v1(0), v2(1), v3(2) }
90 */
91 if (version < 0 || version > 2)
92 return (0);
87 if (x->cert_info->version == NULL) { 93 if (x->cert_info->version == NULL) {
88 if ((x->cert_info->version = ASN1_INTEGER_new()) == NULL) 94 if ((x->cert_info->version = ASN1_INTEGER_new()) == NULL)
89 return (0); 95 return (0);