From: Andreas Schwab <schwab@suse.de>
To: Joe Simmons-Talbott via Libc-alpha <libc-alpha@sourceware.org>
Cc: Joe Simmons-Talbott <josimmon@redhat.com>
Subject: Re: [PATCH v3] resolv/nss_dns/dns-host: Get rid of alloca.
Date: Mon, 14 Aug 2023 16:23:01 +0200 [thread overview]
Message-ID: <mvma5utd7p6.fsf@suse.de> (raw)
In-Reply-To: <20230814141103.2387799-1-josimmon@redhat.com> (Joe Simmons-Talbott via Libc-alpha's message of "Mon, 14 Aug 2023 10:10:35 -0400")
On Aug 14 2023, Joe Simmons-Talbott via Libc-alpha wrote:
> diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
> index 1d60c51f5e..160a017d42 100644
> --- a/resolv/nss_dns/dns-host.c
> +++ b/resolv/nss_dns/dns-host.c
> @@ -395,8 +395,8 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
> */
> if (strchr (name, '.') == NULL)
> {
> - char *tmp = alloca (NS_MAXDNAME);
> - const char *cp = __res_context_hostalias (ctx, name, tmp, NS_MAXDNAME);
> + char tmp[NS_MAXDNAME];
> + const char *cp = __res_context_hostalias (ctx, name, tmp, sizeof (tmp));
> if (cp != NULL)
> name = cp;
> }
We don't tolerate undefined behaviour in glibc.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
next prev parent reply other threads:[~2023-08-14 14:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 14:10 Joe Simmons-Talbott
2023-08-14 14:23 ` Andreas Schwab [this message]
2023-08-14 14:28 ` Siddhesh Poyarekar
2023-08-14 15:01 ` Joe Simmons-Talbott
2023-08-14 14:23 ` Siddhesh Poyarekar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mvma5utd7p6.fsf@suse.de \
--to=schwab@suse.de \
--cc=josimmon@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).