[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
Fri Dec 10 13:18:10 CET 2021
Tim Rühsen commented:
Using PATH_MAX (from gnulib) vs an unbound heap allocation should at least considered.
The pros are
- no costly heap memory allocation for temporary strings
- less overhead (free) / no need to track pointers when prematurly exiting a function
- no risk of double free or NULL pointer access
- bounded (stack) allocation seems to be more "secure" than an unbounded heap allocation (that might turn into a DOS attack vector)
- library functions that do not allocate memory are preferable; there are situations where runtime allocations are just not allowed in an application except for the initialization phase
The cons are
- possibly stack overflow on system with a small stack (not sure, but doesn't Windows have a small stack by default ?)
- GNU/Hurd has no limits on the path size. But IMO it seems to be ok to limit PATH_MAX to 4096.
So my question clearly is: why did you decide against the gnulib module ?
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_763282104
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gnutls-devel