diff mbox series

resolv/res_query: Add not indicating that alloca usage is safe.

Message ID 20230705180703.1469847-1-josimmon@redhat.com
State New
Headers show
Series resolv/res_query: Add not indicating that alloca usage is safe. | expand

Commit Message

Joe Simmons-Talbott July 5, 2023, 6:07 p.m. UTC
The buffer size is small (< 1024) and fixed sized so alloca is safe
here.
---
 resolv/res_query.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Joe Simmons-Talbott July 5, 2023, 6:13 p.m. UTC | #1
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
>
diff mbox series

Patch

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;