GnuTLS | Fix discard const qualifier (!2073)

Read-only notification of GnuTLS library development activities <[email protected]>
Newsgroups gmane.comp.encryption.gpg.gnutls.devel
Message-ID <[email protected]>

Rudi Heitbaum created a merge request: https://gitlab.com/gnutls/gnutls/-/merge_requests/2073

Project:Branches: rudi20/gnutls:const to gnutls/gnutls:master
Author:   Rudi Heitbaum



<!-- Add a description of the new feature/bug fix. Reference any relevant bugs. -->

* Fix discard const qualifier

Since glibc-2.43 and 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.

additional and p pointer returns are only being used for comparisons so declare
them as const, which matches the input hexchars variable.

fixes:
```
    ../../../lib/x509/hostname-verify.c: In function 'gnutls_x509_crt_check_hostname2':
    ../../../lib/x509/hostname-verify.c:165:17: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
      165 |             ((p = strchr(hostname, ':')) != NULL ||
          |                 ^
    ../../../lib/x509/ip.c: In function 'gnutls_x509_cidr_to_rfc5280':
    ../../../lib/x509/ip.c:233:11: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
      233 |         p = strchr(cidr, '/');
          |           ^
    ../../lib/priority.c: In function '_gnutls_resolve_priorities':
    ../../lib/priority.c:2534:20: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     2534 |         additional = strchr(ss, ':');
          |                    ^
    ../../lib/str.c: In function '_gnutls_hostname_compare':
    ../../lib/str.c:722:19: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
      722 |                 p = strrchr(certname, '.');
          |                   ^
```

## Checklist
 * [X] Commits have `Signed-off-by:` with name/author being identical to the commit author
 * [ ] Code modified for feature
 * [ ] Test suite updated with functionality tests
 * [ ] Test suite updated with negative tests
 * [ ] Documentation updated / NEWS entry present (for non-trivial changes)

## Reviewer's checklist:
 * [ ] Any issues marked for closing are addressed
 * [ ] There is a test suite reasonably covering new functionality or modifications
 * [ ] Function naming, parameters, return values, types, etc., are consistent and according to `CONTRIBUTION.md`
 * [ ] This feature/change has adequate documentation added
 * [ ] No obvious mistakes in the code

Additional warnings will be PRed in upstream.
```

../../../lib/minitasn1/parser_aux.c: In function 'asn1_find_node':
../../../lib/minitasn1/parser_aux.c:148:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  148 |       n_end = strchr (n_start, '.');    /* search the first dot */
      |             ^
../../../lib/minitasn1/parser_aux.c:189:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  189 |       n_end = strchr (n_start, '.');    /* search the next dot */
      |             ^

```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/2073
You're receiving this email because of your account on gitlab.com. Unsubscribe from this thread: https://gitlab.com/-/sent_notifications/3-dhyz3plr2e1exf9reagvdkwmg/unsubscribe | Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
Gnutls-devel mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnutls-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.