From patchwork Mon Aug 23 08:39:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 44739 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1572D385842C for ; Mon, 23 Aug 2021 08:39:53 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id 30F16385782D for ; Mon, 23 Aug 2021 08:39:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 30F16385782D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nefkom.net Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4GtQdk1Dntz1qwy6 for ; Mon, 23 Aug 2021 10:39:22 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4GtQdk18G9z1qqkH for ; Mon, 23 Aug 2021 10:39:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id iBnHrE5ewkyo for ; Mon, 23 Aug 2021 10:39:21 +0200 (CEST) X-Auth-Info: /Y3jQBbJqQ85rVinKGsdvTL26GOOXjh1vAS8cVjlzz/MrS1VyRStbuEdvT8TaG5c Received: from igel.home (ppp-46-244-177-181.dynamic.mnet-online.de [46.244.177.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA for ; Mon, 23 Aug 2021 10:39:21 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 19D8D2C07D8; Mon, 23 Aug 2021 10:39:21 +0200 (CEST) From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] rtld: copy terminating null in tunables_strdup (bug 28256) X-Yow: FISH-NET-FISH-NET-FISH-NET-FISH-NET-FISH!! Date: Mon, 23 Aug 2021 10:39:21 +0200 Message-ID: <87tujgsgg6.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Avoid triggering a false positive in valgrind by copying the terminating null in tunables_strdup. At this point the heap is still clean, but valgrind is stricter here. Reviewed-by: Siddhesh Poyarekar --- elf/dl-tunables.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c index 8009e54ee5..1666736bc1 100644 --- a/elf/dl-tunables.c +++ b/elf/dl-tunables.c @@ -56,8 +56,6 @@ tunables_strdup (const char *in) if (out == (void *)-1) _dl_fatal_printf ("sbrk() failure while processing tunables\n"); - i--; - while (i-- > 0) out[i] = in[i];