From: Collin Funk Date: Sat, 28 Mar 2026 07:41:01 +0000 (-0700) Subject: Fix -Wdiscarded-qualifiers warnings shown when glibc-2.43 is used X-Git-Tag: openssl-4.0.0~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0577a4c4bf665724590aed9ce98d4cb93526ae8;p=thirdparty%2Fopenssl.git Fix -Wdiscarded-qualifiers warnings shown when glibc-2.43 is used When building with glibc-2.43 there is the following warning: crypto/x509/x509_vpm.c: In function 'validate_email_name': crypto/x509/x509_vpm.c:317:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 317 | if ((at = memchr(name, '@', len)) == NULL) | ^ This is due to a change described in the NEWS file of glibc-2.43: * For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers into their input arrays now have definitions as macros that return a pointer to a const-qualified type when the input argument is a pointer to a const-qualified type. Systems using this recent glibc version will likely also be using GCC 15 or later which default to `-std=gnu23`, meaning that this warning will show up without modifying `CFLAGS`. We can make these pointers const since we never write to them. Complements: f584ae959cbc "Let's support multiple names for certificate verification" Reviewed-by: Eugene Syromiatnikov Reviewed-by: Paul Dale MergeDate: Tue Mar 31 02:38:14 2026 (Merged from https://github.com/openssl/openssl/pull/30613) (cherry picked from commit 22a3bf628db5f4e7896800ace035f827098830ad) --- diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c index d05f34c00d7..202a205515e 100644 --- a/crypto/x509/x509_vpm.c +++ b/crypto/x509/x509_vpm.c @@ -304,7 +304,7 @@ static int validate_local_part(const char *name, size_t len, static int validate_email_name(const char *name, size_t len, int rfc822) { size_t dns_len, local_len; - char *at, *next, *dnsname; + const char *at, *next, *dnsname; ossl_charset_t local_charset; /*