From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D40CF3857359 for ; Mon, 28 Aug 2023 13:22:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D40CF3857359 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693228922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4Xbm+KQHT7UOKhb8PL/pDqvyVJqjAIVSBmsXzFW6Yec=; b=Qu0KXj5YZAxqJxTzdFb3G2KN2J6OsmRsP7F0fH4hsjFh14YphTnWm/09NaUbJoKHJCH5s7 7n+14i2G2ZDoFOwh49zTflhGMf/MsQysjAj6K9N9WIwewH1XhYjGa/rCTixPqDWNdyKzY1 axVKe+CqusINMw6W1JcjFqlHXAevdNo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-lUca9zRfOjOv5Z4zc1ma7w-1; Mon, 28 Aug 2023 09:22:01 -0400 X-MC-Unique: lUca9zRfOjOv5Z4zc1ma7w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E8C1580192F for ; Mon, 28 Aug 2023 13:22:00 +0000 (UTC) Received: from oak (unknown [10.22.33.147]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D37602166B25 for ; Mon, 28 Aug 2023 13:22:00 +0000 (UTC) Date: Mon, 28 Aug 2023 09:21:59 -0400 From: Joe Simmons-Talbott To: libc-alpha@sourceware.org Subject: Re: [PATCH] resolv/res_query: Add note indicating that alloca usage is safe. Message-ID: <20230828132159.GW3849957@oak> References: <20230705181341.1470594-1-josimmon@redhat.com> <20230810134655.GK3849957@oak> MIME-Version: 1.0 In-Reply-To: <20230810134655.GK3849957@oak> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Ping. On Thu, Aug 10, 2023 at 09:46:55AM -0400, Joe Simmons-Talbott via Libc-alpha wrote: > On Wed, Jul 05, 2023 at 02:13:41PM -0400, Joe Simmons-Talbott wrote: > > The buffer size is small (< 1024) and fixed sized so alloca is safe > > here. > Ping. > > 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 > > >