<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">
<p style="color: #777777;">
<a href="https://gitlab.com/rockdaboot">Tim Rühsen</a>
<a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_763282104">commented</a>:
</p>
<div style="">
<p dir="auto">Using PATH_MAX (from gnulib) vs an unbound heap allocation should at least considered.</p>
<p dir="auto">The pros are</p>
<ul dir="auto">
<li>no costly heap memory allocation for temporary strings</li>
<li>less overhead (free) / no need to track pointers when prematurly exiting a function</li>
<li>no risk of double free or NULL pointer access</li>
<li>bounded (stack) allocation seems to be more "secure" than an unbounded heap allocation (that might turn into a DOS attack vector)</li>
<li>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</li>
</ul>
<p dir="auto">The cons are</p>
<ul dir="auto">
<li>possibly stack overflow on system with a small stack (not sure, but doesn't Windows have a small stack by default ?)</li>
<li>GNU/Hurd has no limits on the path size. But IMO it seems to be ok to limit PATH_MAX to 4096.</li>
</ul>
<p dir="auto">So my question clearly is: why did you decide against the gnulib module ?</p>
</div>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">
—
<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_763282104">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/19a0f1a74288a9a62ec387cb125b3d7c/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Merge request","url":"https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_763282104"}}</script>
</p>
</div>
</body>
</html>