[gnutls-devel] GnuTLS | trust: make filesystem path construction flexible (!1493)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Sat Dec 24 14:28:00 CET 2022




Tim Rühsen started a new discussion on lib/pathbuf.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_1220510420

> +int
> +_gnutls_pathbuf_truncate(struct gnutls_pathbuf_st *buffer, size_t len)
> +{
> +	if (len > buffer->len) {
> +		return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
> +	}
> +	buffer->len = len;
> +	buffer->ptr[len] = '\0';
> +	return 0;
> +}
> +
> +void
> +_gnutls_pathbuf_deinit(struct gnutls_pathbuf_st *buffer)
> +{
> +	if (buffer->ptr != buffer->base) {
> +		gnutls_free(buffer->ptr);

To quickly crash on a re-use after deinit, I'd reset/nullify the whole structure here.
As long as this isn't done in a very hot path, it should be fine.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_1220510420
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/20221224/404ac166/attachment-0001.html>


More information about the Gnutls-devel mailing list