[PATCH 3/3] Add _FORTIFY_SOURCE support for inet_ntop

Frederic Berat fberat@redhat.com
Tue Mar 18 09:49:32 GMT 2025


On Mon, Mar 17, 2025 at 2:43 PM Cristian Rodríguez <cristian@rodriguez.im>
wrote:

> On Mon, Mar 17, 2025 at 9:52 AM Frédéric Bérat <fberat@redhat.com> wrote:
> >
> > - Create the __inet_ntop_chk routine that verifies that the builtin size
> > of the destination buffer is at least as big as the size given by the
> > user.
>
> > +const char *
> > +__inet_ntop_chk (int af, const void *src, char *dst,
> > +                socklen_t size, size_t dst_size)
> > +{
> > +  if (size > dst_size)
> > +    __chk_fail ();
> > +
>
> Just a tiny suggestion/request.  __chk_fail (); is very generic and
> user unfriendly, please use something like __libc_fatal("inet_ntop
> destination buffer is too small") or something meaningful.
>

Fair enough, I merely followed the pattern I've seen on other checks, I'm
fine to change that.
I'll wait for a bit more feedback before sending a v2.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250318/aa6513e4/attachment.htm>


More information about the Libc-alpha mailing list