[PATCH] resolv/nss_dns/dns-host: Note the usage of alloca is safe.
Joe Simmons-Talbott
josimmon@redhat.com
Thu Aug 10 13:46:35 GMT 2023
On Wed, Jul 05, 2023 at 02:58:35PM -0400, Joe Simmons-Talbott wrote:
> Since the size is relatively small and constant add a comment that the
> usage of alloca is safe.
Ping.
Thanks,
Joe
> ---
> resolv/nss_dns/dns-host.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
> index 1d60c51f5e..d3aaeec293 100644
> --- a/resolv/nss_dns/dns-host.c
> +++ b/resolv/nss_dns/dns-host.c
> @@ -395,6 +395,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
> */
> if (strchr (name, '.') == NULL)
> {
> + /* alloca is safe here since the size is small and constant. */
> char *tmp = alloca (NS_MAXDNAME);
> const char *cp = __res_context_hostalias (ctx, name, tmp, NS_MAXDNAME);
> if (cp != NULL)
> --
> 2.39.2
>
More information about the Libc-alpha
mailing list