From patchwork Wed Jul 5 18:58:35 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: 1803948 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=XLhoKwLr; 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 4Qx88K6QQvz20ZQ for ; Thu, 6 Jul 2023 04:58:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6F92C3856DD0 for ; Wed, 5 Jul 2023 18:58:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F92C3856DD0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688583534; bh=NWmF7xDQV9/zHZBV4NUzWt0aV6hWNNiwJXIRkgQuFcE=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=XLhoKwLr7xEC5Diec2mK2r2GMbIUXdJOqM2eL+sAVFYyWK5Ha8KQATkmqmTphW/Pa N3htvOy9/HZ7qIZhpTpFMgda0YANzBfDdbcg6tN79OQq8fUouxBBgqYMdAjgVoBRY8 bVbFiCVTSthO65DEzO3Cz7t5Sl6LNEKb08YjklUs= 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 AD6383856967 for ; Wed, 5 Jul 2023 18:58:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD6383856967 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237-3F5lyl76NHy8mU3t5_2npw-1; Wed, 05 Jul 2023 14:58:38 -0400 X-MC-Unique: 3F5lyl76NHy8mU3t5_2npw-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-635d9e482f1so125736d6.1 for ; Wed, 05 Jul 2023 11:58:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688583517; x=1691175517; 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=NWmF7xDQV9/zHZBV4NUzWt0aV6hWNNiwJXIRkgQuFcE=; b=XrayCd/81EvZmeVL7IrNlVvivFRnQ631356lpXsCnPH5Sa7lgkYuTtx4Vhv/UAwnC5 Z9j3cHe0qX+yDLJXKexOytwmEezWMfyXXE7J9Aa3xj8/aO77hiBgMGFcLc+Lw43niwDK 5EfaysH8UT8OiFzLueZs+uUBLHTK+WZXFAtlhYh43Qg3+yy1zdJvGzPqGCNfGRvXSotf xPksxPzO8YlXIEAOoifizrbY+cUJ22owB8ITGNiY0QPn2gJOztVI0m0DYSd2oxzSHYKq 5hwquabO/sTSRuKEOlPoygnKDw2yH3+dGHWRN1NWmraRoU4kSnkRF302LGb9OQuowa+u AQUg== X-Gm-Message-State: ABy/qLZjL7aMp7etMMYNxoxacxRsqVeNWzVcH2W7SSgDdQcBrJddA6DE GxwttW9LBESvw/hSPvElqauLzVPuElJvv5bKW9XdB0r5D58Sg0Vtr6nFPCdOPJOdXFsec0pjj8f lCfC3PW2JLZBYYjKLZQ0jRtZWsVFpA3OmSHCUh4GQ7ExrbBhsgLSCxkBkjfBTqzRkidcdMRXtSR AIervD X-Received: by 2002:ad4:5943:0:b0:632:30e:314 with SMTP id eo3-20020ad45943000000b00632030e0314mr18573121qvb.44.1688583517661; Wed, 05 Jul 2023 11:58:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlFJgEQFVDU0K8kV0ZMhuH3vUvQ5QwqeNXKWKXNykok9XbKU/U69dUuc3MSb1uvgzXk/WcE0zQ== X-Received: by 2002:ad4:5943:0:b0:632:30e:314 with SMTP id eo3-20020ad45943000000b00632030e0314mr18573109qvb.44.1688583517352; Wed, 05 Jul 2023 11:58:37 -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 pe34-20020a05620a852200b007623c96430csm11368251qkn.111.2023.07.05.11.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 11:58:36 -0700 (PDT) To: libc-alpha@sourceware.org Cc: Joe Simmons-Talbott Subject: [PATCH] resolv/nss_dns/dns-host: Note the usage of alloca is safe. Date: Wed, 5 Jul 2023 14:58:35 -0400 Message-Id: <20230705185835.1474212-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" Since the size is relatively small and constant add a comment that the usage of alloca is safe. --- resolv/nss_dns/dns-host.c | 1 + 1 file changed, 1 insertion(+) diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 1d60c51f5e..d3aaeec293 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -395,6 +395,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, */ if (strchr (name, '.') == NULL) { + /* alloca is safe here since the size is small and constant. */ char *tmp = alloca (NS_MAXDNAME); const char *cp = __res_context_hostalias (ctx, name, tmp, NS_MAXDNAME); if (cp != NULL)