[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 09:12:48 CET 2020




Daiki Ueno commented on a discussion on src/psk.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1345#note_438798874

> +	/* 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);

Good catch indeed, fixed!

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1345#note_438798874
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/495ee9a6/attachment.html>


More information about the Gnutls-devel mailing list