From: Andreas Schwab <schwab@linux-m68k.org>
To: Joe Simmons-Talbott <josimmon@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] resolv: Get rid of alloca usage.
Date: Thu, 21 Sep 2023 19:36:08 +0200 [thread overview]
Message-ID: <875y43tomv.fsf@igel.home> (raw)
In-Reply-To: <20230921161613.3609632-1-josimmon@redhat.com> (Joe Simmons-Talbott's message of "Thu, 21 Sep 2023 12:16:08 -0400")
On Sep 21 2023, Joe Simmons-Talbott wrote:
> diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
> index 1e6511a4f4..b67542c078 100644
> --- a/resolv/nss_dns/dns-network.c
> +++ b/resolv/nss_dns/dns-network.c
> @@ -116,6 +116,7 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
> querybuf *orig_net_buffer;
> int anslen;
> enum nss_status status;
> + char buf[1024];
>
> struct resolv_context *ctx = __resolv_context_get ();
> if (ctx == NULL)
> @@ -125,7 +126,7 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
> return NSS_STATUS_UNAVAIL;
> }
>
> - net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
> + net_buffer.buf = orig_net_buffer = (querybuf *) &buf;
The buffer should be suitably aligned for querybuf. Since buf is an
array, it should not get an address-of operator.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
next prev parent reply other threads:[~2023-09-21 17:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 16:16 Joe Simmons-Talbott
2023-09-21 17:36 ` Andreas Schwab [this message]
2023-09-22 14:24 ` Joe Simmons-Talbott
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=875y43tomv.fsf@igel.home \
--to=schwab@linux-m68k.org \
--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).