[gnutls-devel] GnuTLS | psktool: encode username if it contains special character (!1345)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Fri Oct 30 08:57:28 CET 2020
Sahana Prasad started a new discussion on src/psk.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1345#note_438791716
> + /* encode username if it contains special characters */
> + if (strcspn(username, ":\n") != strlen(username)) {
> + char *new_data;
> +
> + tmp.data = (void *)username;
> + tmp.size = strlen(username);
> +
> + ret = gnutls_hex_encode2(&tmp, &_username);
> + if (ret < 0) {
> + fprintf(stderr, "HEX encoding error\n");
> + ret = -1;
> + goto out;
> + }
> +
> + /* prepend '#' */
> + new_data = gnutls_realloc(_username.data, _username.size + 1);
shouldn't this be +2?
one for '#' and one for '\0'?
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1345#note_438791716
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20201030/d9f712b0/attachment-0001.html>
More information about the Gnutls-devel
mailing list