From fc8ae08d38ed0942c30b796ec05dc7710a2e111a Mon Sep 17 00:00:00 2001 From: beck Date: Mon, 27 Jun 2022 15:03:11 +0000 Subject: [PATCH] Correct misleading comment for URI parsing ok jsing@ --- lib/libcrypto/x509/x509_constraints.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/libcrypto/x509/x509_constraints.c b/lib/libcrypto/x509/x509_constraints.c index c68f282a050..8cd8413dfae 100644 --- a/lib/libcrypto/x509/x509_constraints.c +++ b/lib/libcrypto/x509/x509_constraints.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_constraints.c,v 1.27 2022/06/26 11:29:27 beck Exp $ */ +/* $OpenBSD: x509_constraints.c,v 1.28 2022/06/27 15:03:11 beck Exp $ */ /* * Copyright (c) 2020 Bob Beck * @@ -455,9 +455,15 @@ x509_constraints_valid_domain_constraint(uint8_t *constraint, size_t len) } /* - * Extract the host part of a URI, returns the host part as a c string - * the caller must free, or or NULL if it could not be found or is - * invalid. + * Extract the host part of a URI. On failure to parse a valid host part of the + * URI, 0 is returned indicating an invalid URI. If the host part parses as + * valid, or is not present, 1 is returned indicating a possibly valid URI. + * + * In the case of a valid URI, *hostpart will be set to a copy of the host part + * of the URI, or the empty string if no URI is present. If memory allocation + * fails *hostpart will be set to NULL, even though we returned 1. It is the + * caller's responsibility to indicate an error for memory allocation failure, + * and the callers responsibility to free *hostpart. * * RFC 3986: * the authority part of a uri starts with // and is terminated with -- 2.20.1