From patchwork Wed Jul 5 18:13:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Simmons-Talbott X-Patchwork-Id: 1803937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=tAxX6Z3X; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qx78Y3py7z20ZQ for ; Thu, 6 Jul 2023 04:14:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8803B3858284 for ; Wed, 5 Jul 2023 18:14:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8803B3858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688580843; bh=KwcVdO+Yn7NeXgvQ7Cgd7UIebvR0OKC4qgH7tihGAHk=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=tAxX6Z3X1lvO9xiXgZ7+vVs5GMHM3Wylw2zYq5qSXswZEAuJ4i6UV1cLJQWHBG7Ln r0xsnuNfCj/f0oD3074Ox1Hgam9n5tz0w/7Tr5NJpo6X4VYgXY76n7SuAxMkRdjpjD ueixM9d9Mo4p1jLYICHqtmCz1h7l4Sq96L0r2yCw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id CD3A93857708 for ; Wed, 5 Jul 2023 18:13:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CD3A93857708 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-207-onXc0IkwP4CPAwCSX-LQCQ-1; Wed, 05 Jul 2023 14:13:44 -0400 X-MC-Unique: onXc0IkwP4CPAwCSX-LQCQ-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-635e91cba88so74819456d6.0 for ; Wed, 05 Jul 2023 11:13:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688580823; x=1691172823; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KwcVdO+Yn7NeXgvQ7Cgd7UIebvR0OKC4qgH7tihGAHk=; b=Gg/ZnHwwAwLAUAks7KUkBT+FqjuhUexg/VRLZbDa+S6TBcHArPgGRSu/CJ7KHEjCKI bBMmPLbE1UBa517RCCc1OZya3qeb46GH00LcL81uLlYtQ5MJn1EKfvByW953BpOzzr8K nn3ZrERgmy6rYp5R3a5iJS/wXjMaYrIAKK7lxtiNjGGTs+8Izm+5thoRUVMpdLfVrEK8 4p01rKoMsFaS7/EwQ9qu8bLW0nI6FLjCoRdJenhbjkr75Axg7dqicntTFueJx3o+niAP Tcu2eN+ySHL3DH7bMacmPFUkwVLUttkjIOsY5Ix5UzH7H4GOihyX0zlqykiCV7whuGvw e7mg== X-Gm-Message-State: ABy/qLYHgPIy+04l8yAVDhSFpgVqSiTacBU7gqXQ8519RySrvES25z7p mw4eH64GjGy916+hU6DrAh7QOHu+eg+Dy5/J1d+15P9grplhngEJafvrOmLt3ToQ8DsOpVKpwAM iorqsEGR5jIZ7Wh4A4crDcP3v+wxeqbtVS+Y1oHoV+KDjelu7XAjRyUBwtJX9OnPfD66v0zWYFO bUuBDE X-Received: by 2002:a05:6214:21c1:b0:635:eae1:414 with SMTP id d1-20020a05621421c100b00635eae10414mr23697185qvh.50.1688580823723; Wed, 05 Jul 2023 11:13:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlFvCHtyQWwSQIFOGZxIe1z8MrmUavGnZNs43TZY7EfYoR3Pet+yF6FmQErtoC21NBTwB9Exxw== X-Received: by 2002:a05:6214:21c1:b0:635:eae1:414 with SMTP id d1-20020a05621421c100b00635eae10414mr23697170qvh.50.1688580823473; Wed, 05 Jul 2023 11:13:43 -0700 (PDT) Received: from oak.redhat.com (c-71-206-142-238.hsd1.va.comcast.net. [71.206.142.238]) by smtp.gmail.com with ESMTPSA id ea19-20020ad458b3000000b0062626bd3683sm13943746qvb.59.2023.07.05.11.13.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 11:13:43 -0700 (PDT) To: libc-alpha@sourceware.org Cc: Joe Simmons-Talbott Subject: [PATCH] resolv/res_query: Add note indicating that alloca usage is safe. Date: Wed, 5 Jul 2023 14:13:41 -0400 Message-Id: <20230705181341.1470594-1-josimmon@redhat.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.5 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Joe Simmons-Talbott via Libc-alpha From: Joe Simmons-Talbott Reply-To: Joe Simmons-Talbott Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" 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;