From patchwork Tue Jul 27 17:41:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1510607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: 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=bEEwqnkQ; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GZ40F0rWpz9s1l for ; Wed, 28 Jul 2021 03:43:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D1C593847830 for ; Tue, 27 Jul 2021 17:43:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D1C593847830 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1627407818; bh=nZ9DJuBjC8E3WNxJSh3LrvmGFfNhNXOLLFl0yrIYyLU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=bEEwqnkQ+8UxzgGBMDjk8WPDDkz9Lg2cUZcbOTSKHigxdT+bFVpslVrjv5wjji+jx YpiYgFYtMklNyWNd+8RmBnSYCTdIoffOM5AHBgZ/OBAFE2++WBKjFz7tsXEJpsC0l9 ztxW/OEcASP3J7hGlEi0VWlxz0WguqrknAVJhek8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dog.elm.relay.mailchannels.net (dog.elm.relay.mailchannels.net [23.83.212.48]) by sourceware.org (Postfix) with ESMTPS id 228983839819 for ; Tue, 27 Jul 2021 17:41:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 228983839819 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id BCF0440191C; Tue, 27 Jul 2021 17:41:45 +0000 (UTC) Received: from pdx1-sub0-mail-a35.g.dreamhost.com (100-96-16-89.trex.outbound.svc.cluster.local [100.96.16.89]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 465E8402058; Tue, 27 Jul 2021 17:41:45 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a35.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.16.89 (trex/6.3.3); Tue, 27 Jul 2021 17:41:45 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Glossy-Reign: 4847e4724a9e9cbf_1627407705524_1573184564 X-MC-Loop-Signature: 1627407705524:1841106924 X-MC-Ingress-Time: 1627407705524 Received: from pdx1-sub0-mail-a35.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a35.g.dreamhost.com (Postfix) with ESMTP id 02E1D86717; Tue, 27 Jul 2021 10:41:44 -0700 (PDT) Received: from rhbox.redhat.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a35.g.dreamhost.com (Postfix) with ESMTPSA id 074AE86716; Tue, 27 Jul 2021 10:41:41 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a35 To: libc-alpha@sourceware.org Subject: [PATCH 1/5] ldconfig: avoid leak on empty paths in config file Date: Tue, 27 Jul 2021 23:11:25 +0530 Message-Id: <20210727174129.3612656-2-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210727174129.3612656-1-siddhesh@sourceware.org> References: <20210727174129.3612656-1-siddhesh@sourceware.org> MIME-Version: 1.0 X-Spam-Status: No, score=-3494.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, 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: , X-Patchwork-Original-From: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" --- elf/ldconfig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) Reviewed-by: Arjun Shankar diff --git a/elf/ldconfig.c b/elf/ldconfig.c index 1037e8d0cf..b8893637f8 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -503,7 +503,11 @@ add_dir_1 (const char *line, const char *from_file, int from_line) entry->path[--i] = '\0'; if (i == 0) - return; + { + free (entry->path); + free (entry); + return; + } char *path = entry->path; if (opt_chroot != NULL)