summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2022-08-31 07:15:31 +0000
committertb <>2022-08-31 07:15:31 +0000
commit1af840db6160c4511f1e225122056a69d23d80cd (patch)
tree88f5b5602ade55484690aaa6189a95822613e5a9
parent77eac0ad9b595b925f07dc5b13a0538ec6557aba (diff)
downloadopenbsd-1af840db6160c4511f1e225122056a69d23d80cd.tar.gz
openbsd-1af840db6160c4511f1e225122056a69d23d80cd.tar.bz2
openbsd-1af840db6160c4511f1e225122056a69d23d80cd.zip
Switch loop bounds from size_t to int in check_hosts()
sk_num() can return a negative value, in which case the upper bound is SIZE_MAX, which results in a very long for loop. CID 153997 ok jsing
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c
index 18cf08a07c..fb87877e72 100644
--- a/src/lib/libcrypto/x509/x509_vfy.c
+++ b/src/lib/libcrypto/x509/x509_vfy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_vfy.c,v 1.102 2022/06/27 14:10:22 tb Exp $ */ 1/* $OpenBSD: x509_vfy.c,v 1.103 2022/08/31 07:15:31 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 *
@@ -186,7 +186,7 @@ check_id_error(X509_STORE_CTX *ctx, int errcode)
186static int 186static int
187check_hosts(X509 *x, X509_VERIFY_PARAM_ID *id) 187check_hosts(X509 *x, X509_VERIFY_PARAM_ID *id)
188{ 188{
189 size_t i, n; 189 int i, n;
190 char *name; 190 char *name;
191 191
192 n = sk_OPENSSL_STRING_num(id->hosts); 192 n = sk_OPENSSL_STRING_num(id->hosts);