summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/x509/x509_v3.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/libcrypto/x509/x509_v3.c b/src/lib/libcrypto/x509/x509_v3.c
index fcc6897378..22fa7e1162 100644
--- a/src/lib/libcrypto/x509/x509_v3.c
+++ b/src/lib/libcrypto/x509/x509_v3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_v3.c,v 1.30 2024/05/23 02:00:38 tb Exp $ */ 1/* $OpenBSD: x509_v3.c,v 1.31 2024/07/12 08:39:54 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 *
@@ -94,20 +94,16 @@ int
94X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *sk, 94X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *sk,
95 const ASN1_OBJECT *obj, int lastpos) 95 const ASN1_OBJECT *obj, int lastpos)
96{ 96{
97 int n; 97 if (++lastpos < 0)
98 X509_EXTENSION *ext;
99
100 if (sk == NULL)
101 return -1;
102 lastpos++;
103 if (lastpos < 0)
104 lastpos = 0; 98 lastpos = 0;
105 n = sk_X509_EXTENSION_num(sk); 99
106 for (; lastpos < n; lastpos++) { 100 for (; lastpos < X509v3_get_ext_count(sk); lastpos++) {
107 ext = sk_X509_EXTENSION_value(sk, lastpos); 101 const X509_EXTENSION *ext = X509v3_get_ext(sk, lastpos);
102
108 if (OBJ_cmp(ext->object, obj) == 0) 103 if (OBJ_cmp(ext->object, obj) == 0)
109 return lastpos; 104 return lastpos;
110 } 105 }
106
111 return -1; 107 return -1;
112} 108}
113LCRYPTO_ALIAS(X509v3_get_ext_by_OBJ); 109LCRYPTO_ALIAS(X509v3_get_ext_by_OBJ);