[gnutls-devel] GnuTLS | Allocate pathname on heap instead of on stack (!1493)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Mon Dec 20 19:00:03 CET 2021
Tim Rühsen commented on a discussion: https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_790348720
Yeah, I get this. And I agree with that comment in regards to application code. Though it needs to take special care as "not a constant" may also overflow (or at least stress) the amount of RAM that you have.
And IMO, for library code the pros and cons listed are still valid.
So I wonder if we should discuss other possibilities as well, like supporting only a defined upper path length of e.g. 4095 bytes (excl. 0-byte). This would allow either stack allocation or careful pre-allocation during init phase.
An alternative would be a macro that does stack allocation if path length < 4096, else fall back to heap allocation. A MALLOC and a FREE macro could be used to hide the details.
Maybe you have other ideas ? And 4096 is just an arbitrary values - it could as well be 1024 or 512, as we likely never see such path length in reality.
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_790348720
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/20211220/1ceb50a6/attachment.html>
More information about the Gnutls-devel
mailing list