* [PATCH] resolv/nss_dns/dns-host: Get rid of alloca.
@ 2023-08-10 15:13 Joe Simmons-Talbott
2023-08-10 15:28 ` Andreas Schwab
0 siblings, 1 reply; 3+ messages in thread
From: Joe Simmons-Talbott @ 2023-08-10 15:13 UTC (permalink / raw)
To: libc-alpha; +Cc: Joe Simmons-Talbott
Since the alloca is a small constant size use an array instead.
---
resolv/nss_dns/dns-host.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 1d60c51f5e..f752b7cf4b 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -378,6 +378,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
int *herrnop, int32_t *ttlp)
{
enum nss_status status = check_name (name, herrnop);
+ char tmp[NS_MAXDNAME];
if (status != NSS_STATUS_SUCCESS)
return status;
struct resolv_context *ctx = __resolv_context_get ();
@@ -395,7 +396,6 @@ _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);
if (cp != NULL)
name = cp;
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] resolv/nss_dns/dns-host: Get rid of alloca.
2023-08-10 15:13 [PATCH] resolv/nss_dns/dns-host: Get rid of alloca Joe Simmons-Talbott
@ 2023-08-10 15:28 ` Andreas Schwab
2023-08-10 15:58 ` Joe Simmons-Talbott
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2023-08-10 15:28 UTC (permalink / raw)
To: Joe Simmons-Talbott via Libc-alpha; +Cc: Joe Simmons-Talbott
On Aug 10 2023, Joe Simmons-Talbott via Libc-alpha wrote:
> const char *cp = __res_context_hostalias (ctx, name, tmp, NS_MAXDNAME);
Please use sizeof (tmp).
Ok with that change.
--
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."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] resolv/nss_dns/dns-host: Get rid of alloca.
2023-08-10 15:28 ` Andreas Schwab
@ 2023-08-10 15:58 ` Joe Simmons-Talbott
0 siblings, 0 replies; 3+ messages in thread
From: Joe Simmons-Talbott @ 2023-08-10 15:58 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Joe Simmons-Talbott via Libc-alpha
On Thu, Aug 10, 2023 at 05:28:08PM +0200, Andreas Schwab wrote:
> On Aug 10 2023, Joe Simmons-Talbott via Libc-alpha wrote:
>
> > const char *cp = __res_context_hostalias (ctx, name, tmp, NS_MAXDNAME);
>
> Please use sizeof (tmp).
Fixed in v2.
Thanks,
Joe
>
> Ok with that change.
>
> --
> 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."
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-10 15:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-10 15:13 [PATCH] resolv/nss_dns/dns-host: Get rid of alloca Joe Simmons-Talbott
2023-08-10 15:28 ` Andreas Schwab
2023-08-10 15:58 ` Joe Simmons-Talbott
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).