From: "cron2 (Code Review)" Date: Thu, 19 Feb 2026 10:00:45 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="gYAAjYIkrXA="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[release/2.6]: dns: fix discards 'const' qualifier from pointer target type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --gYAAjYIkrXA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/15= 44?usp=3Demail ) Change subject: dns: fix discards 'const' qualifier from pointer target type ...................................................................... dns: fix discards 'const' qualifier from pointer target type Since 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. fixes: src/openvpn/dns.c: In function 'dns_server_addr_parse': src/openvpn/dns.c:67:25: warning: initialization discards 'const' quali= fier from pointer target type [-Wdiscarded-qualifiers] 67 | char *first_colon =3D strchr(addr, ':'); | ^~~~~~ src/openvpn/dns.c:68:24: warning: initialization discards 'const' quali= fier from pointer target type [-Wdiscarded-qualifiers] 68 | char *last_colon =3D strrchr(addr, ':'); | ^~~~~~~ Change-Id: I262705189edfbd9aa9a32bcd712840fffa592435 Signed-off-by: Rudi Heitbaum Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1542 Acked-by: Frank Lichtenheld Message-Id: <20260218214738.27158-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 730.html Signed-off-by: Gert Doering (cherry picked from commit 0157e7fb8ae29b637537a6b98ce85217c6daf5a3) --- M src/openvpn/dns.c 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c index 7de3991..66ac32f 100644 --- a/src/openvpn/dns.c +++ b/src/openvpn/dns.c @@ -38,7 +38,7 @@ * @return True if parsing was successful */ static bool -dns_server_port_parse(in_port_t *port, char *port_str) +dns_server_port_parse(in_port_t *port, const char *port_str) { char *endptr; errno =3D 0; @@ -64,8 +64,8 @@ in_port_t port =3D 0; sa_family_t af; - char *first_colon =3D strchr(addr, ':'); - char *last_colon =3D strrchr(addr, ':'); + const char *first_colon =3D strchr(addr, ':'); + const char *last_colon =3D strrchr(addr, ':'); if (!first_colon || first_colon =3D=3D last_colon) { @@ -86,7 +86,7 @@ if (addr[0] =3D=3D '[') { addr +=3D 1; - char *bracket =3D last_colon - 1; + const char *bracket =3D last_colon - 1; if (*bracket !=3D ']' || bracket =3D=3D addr || !dns_server_po= rt_parse(&port, last_colon + 1)) { return false; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1544?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: I262705189edfbd9aa9a32bcd712840fffa592435 Gerrit-Change-Number: 1544 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --gYAAjYIkrXA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

dns: fix discards 'const' qualifier from=
 pointer target type

Since glibc-2.43:

For ISO C23, the funct= ions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk,= wcsrchr, wcsstr and wmemchr that return pointers
into their input array= s now have definitions as macros that return a
pointer to a const-qualif= ied type when the input argument is a pointer
to a const-qualified type.=

fixes:
src/openvpn/dns.c: In function 'dns_server_addr_p= arse':
src/openvpn/dns.c:67:25: warning: initialization discards= 'const' qualifier from pointer target type [-Wdiscarded-qualifiers= ]
67 | char *first_colon =3D strchr(addr, ':');
= | ^~~~~~
src/openvpn/dns.c:68:24: wa= rning: initialization discards 'const' qualifier from pointer targe= t type [-Wdiscarded-qualifiers]
68 | char *last_colon =3D str= rchr(addr, ':');
| ^~~~~~~
<= br>Change-Id: I262705189edfbd9aa9a32bcd712840fffa592435
Signed-off-by: R= udi Heitbaum <rudi@...2993...>
Acked-by: Gert Doering <gert@...493...= 1296...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1542
A= cked-by: Frank Lichtenheld <frank@...2641...>
Message-Id: <2026= 0218214738.27158-1-gert@...1296...>
URL: https://www.mail-archive.com= /openvpn-devel@lists.sourceforge.net/msg35730.html
Signed-off-by: Gert D= oering <gert@...1296...>
(cherry picked from commit 0157e7fb8ae29b= 637537a6b98ce85217c6daf5a3)
---
M src/openvpn/dns.c
1 file changed= , 4 insertions(+), 4 deletions(-)

diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c
index= 7de3991..66ac32f 100644
--- a/src/openvpn/dns.c
= +++ b/src/openvpn/dns.c
@@ -38,7 +38,7 @@
<= span> * @return True if parsing was successful
*/
static bool
-dns_server_port_parse(in_port_t *port, char *port_str)=
+dns_server_port_parse(in_p= ort_t *port, const char *port_str)
{
= char *endptr;
errno =3D 0;
@@ -64,8 +6= 4,8 @@
in_port_t port =3D 0;
sa_f= amily_t af;

- char *first_colon =3D strchr(addr, ':');
- char *last_colon =3D strrchr(add= r, ':');
+ = const char *first_colon =3D strchr(addr, ':');
+ const char *last_colon =3D strrchr(= addr, ':');

if (!first_colon= || first_colon =3D=3D last_colon)
{
@= @ -86,7 +86,7 @@
if (addr[0] =3D=3D '[')
{
addr +=3D 1;<= br>- char *bracket =3D= last_colon - 1;
+ = const char *bracket =3D last_colon - 1;
= if (*bracket !=3D ']' || bracket =3D=3D addr || !dns_server_port= _parse(&port, last_colon + 1))
{ return false;

T= o view, visit change 1544. To unsubscribe, or for help writing mail filters, vi= sit settings= .

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I262705189edfbd9aa9a32bcd712= 840fffa592435
Gerrit-Change-Number: 1544
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --gYAAjYIkrXA=--