From: Beat Bolli Date: Wed, 11 Mar 2026 12:11:06 GMT Subject: [PATCH 3/4] imap-send: remove two string length checks Message-ID: <20260311121107.1122387-4-dev+git@drbeat.li> In-Reply-To: <20260311121107.1122387-1-dev+git@drbeat.li> At this point, these two checks verify that the ASN1_STRINGs are internally consistent. This may have been ok when the fields were accessed directly, but now that the API is used, is unnecessary. Remove the two checks. Signed-off-by: Beat Bolli --- imap-send.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/imap-send.c b/imap-send.c index 2a904314dd..2bb0003f08 100644 --- a/imap-send.c +++ b/imap-send.c @@ -253,8 +253,6 @@ static int verify_hostname(X509 *cert, const char *hostname) ASN1_STRING *subj_alt_str = GENERAL_NAME_get0_value(subj_alt_name, &ntype); if (ntype == GEN_DNS && - strlen((const char *)ASN1_STRING_get0_data(subj_alt_str)) == - ASN1_STRING_length(subj_alt_str) && host_matches(hostname, (const char *)ASN1_STRING_get0_data(subj_alt_str))) found = 1; } @@ -270,8 +268,7 @@ static int verify_hostname(X509 *cert, const char *hostname) (cname_entry = X509_NAME_get_entry(subj, i)) == NULL || (cname = X509_NAME_ENTRY_get_data(cname_entry)) == NULL) return error("cannot get certificate common name"); - if (strlen((const char *)ASN1_STRING_get0_data(cname)) == ASN1_STRING_length(cname) && - host_matches(hostname, (const char *)ASN1_STRING_get0_data(cname))) + if (host_matches(hostname, (const char *)ASN1_STRING_get0_data(cname))) return 0; return error("certificate owner '%s' does not match hostname '%s'", ASN1_STRING_get0_data(cname), hostname); -- 2.51.0