Skip to contentSkip to conversation

ntlm: fix discards 'const' qualifier from pointer target type

PATCH In review Rudi Heitbaum 2 participants 2 messages Feb 16 – Feb 18

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 ntlm: 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/ntlm.c: In function 'ntlm_phase_3':
src/openvpn/ntlm.c:241:15: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
241 | separator = strchr(p->up.username, '\\');
| ^

---
 src/openvpn/ntlm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/ntlm.c +1 -1
index 8e913dce..244ee945 100644
@@ -218,7 +218,7 @@ ntlm_phase_3(const struct http_proxy_info *p, const char *phase_2, struct gc_are
 
     char domain[128];
     char username[128];
-    char *separator;
+    const char *separator;
 
     ASSERT(strlen(p->up.username) > 0);
     ASSERT(strlen(p->up.password) > 0);
Signature · 1 line
2.51.0
Acked-by on v2 2/2
#1 lore raw
Quoted 14 lines · Rudi Heitbaum via Openvpn-devel

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/ntlm.c: In function 'ntlm_phase_3':
src/openvpn/ntlm.c:241:15: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
241 | separator = strchr(p->up.username, '\\');
| ^

Quoted 4 lines
---
 src/openvpn/ntlm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

https://gerrit.openvpn.net/c/openvpn/+/1546

Regards,

Signature · 1 line
  Frank Lichtenheld