[PATCH 3/3] Add _FORTIFY_SOURCE support for inet_ntop

Cristian Rodríguez cristian@rodriguez.im
Mon Mar 17 13:42:41 GMT 2025


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.


More information about the Libc-alpha mailing list