[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 15:44:26 CET 2020

Merge request https://gitlab.com/gnutls/gnutls/-/merge_requests/1345 was reviewed by Anderson Sasaki

Anderson Sasaki started a new discussion on src/psk.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1345#note_439063374

> +			goto out;
> +		}
> +		memmove(_username.data + 1, _username.data, _username.size);

I'm not sure, but shouldn't this ``memmove()`` use ``new_data + 1`` as the target instead of ``_username.data + 1``. My concern is because I believe the new allocated memory is not necessarily in the same address as the original pointer.

Anderson Sasaki started a new discussion on src/psk.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1345#note_439063380

> +		memmove(_username.data + 1, _username.data, _username.size);
> +		new_data[0] = '#';
> +		new_data[_username.size] = '\0';

Shouldn't the ``_username.size`` be incremented before assigning the closer ``'\0'``? Couldn't this unintentionally remove the last character?

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

More information about the Gnutls-devel mailing list