public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] resolv/res_query: Add not indicating that alloca usage is safe.
@ 2023-07-05 18:07 Joe Simmons-Talbott
  2023-07-05 18:13 ` Joe Simmons-Talbott
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Simmons-Talbott @ 2023-07-05 18:07 UTC (permalink / raw)
  To: libc-alpha; +Cc: Joe Simmons-Talbott

The buffer size is small (< 1024) and fixed sized so alloca is safe
here.
---
 resolv/res_query.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/resolv/res_query.c b/resolv/res_query.c
index 049de91b95..0e0e7be624 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -117,6 +117,7 @@ __res_context_query (struct resolv_context *ctx, const char *name,
 	int n, use_malloc = 0;
 
 	size_t bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * QUERYSIZE;
+	/* alloca is safe here since bufsize < 1024 and fixed sized. */
 	u_char *buf = alloca (bufsize);
 	u_char *query1 = buf;
 	int nquery1 = -1;
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] resolv/res_query: Add not indicating that alloca usage is safe.
  2023-07-05 18:07 [PATCH] resolv/res_query: Add not indicating that alloca usage is safe Joe Simmons-Talbott
@ 2023-07-05 18:13 ` Joe Simmons-Talbott
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Simmons-Talbott @ 2023-07-05 18:13 UTC (permalink / raw)
  To: libc-alpha

On Wed, Jul 05, 2023 at 02:07:03PM -0400, Joe Simmons-Talbott wrote:
> The buffer size is small (< 1024) and fixed sized so alloca is safe
> here.

Please disregard.  There's a typo in the subject.  I'll resend.

Thanks,
Joe
> ---
>  resolv/res_query.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/resolv/res_query.c b/resolv/res_query.c
> index 049de91b95..0e0e7be624 100644
> --- a/resolv/res_query.c
> +++ b/resolv/res_query.c
> @@ -117,6 +117,7 @@ __res_context_query (struct resolv_context *ctx, const char *name,
>  	int n, use_malloc = 0;
>  
>  	size_t bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * QUERYSIZE;
> +	/* alloca is safe here since bufsize < 1024 and fixed sized. */
>  	u_char *buf = alloca (bufsize);
>  	u_char *query1 = buf;
>  	int nquery1 = -1;
> -- 
> 2.39.2
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-05 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 18:07 [PATCH] resolv/res_query: Add not indicating that alloca usage is safe Joe Simmons-Talbott
2023-07-05 18:13 ` 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).