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

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Sun Dec 25 02:55:58 CET 2022




Daiki Ueno commented on a discussion on lib/pathbuf.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_1220571071

> +
> +	/* path separator */
> +	if (!INT_ADD_OK(len, 1, &len)) {
> +		return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
> +	}
> +
> +	ret = pathbuf_reserve(buffer, len);
> +	if (ret < 0) {
> +		return ret;
> +	}
> +
> +	p = stpcpy(&buffer->ptr[buffer->len], "/");
> +	p = stpcpy(p, component);
> +	*p = '\0';
> +
> +	buffer->len += len;

I think it is safe to assume no overflow can happen at this point, because the above `pathbuf_reserve` checks that. I've added a comment to be more explicit.

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


More information about the Gnutls-devel mailing list