Message ID | ad13cbf655f1fdd1e9e704bf2ab1491a7ad9b082.1675461748.git.sander@svanheule.net |
---|---|
State | Accepted |
Delegated to: | Sander Vanheule |
Headers | show
Return-Path: <openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=<UNKNOWN>) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=YbDrRwhB; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 header.s=mail1707 header.b=d1WF5TPB; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (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 4P7qWq0QzZz23r0 for <incoming@patchwork.ozlabs.org>; Sat, 4 Feb 2023 09:07:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ngeQpr25zGttx6BWEUA4RIRlbj+ct6Jt/de0ySMEVV0=; b=YbDrRwhBqZ3/Gh NaKOyWZUDEP34WJUYMHNSQ090Y1NSAG4we0KC25xMXY3Js8zgCB5OQAsJNRweNFzMmdR2erat9xSt uSyAZ1woH09DApDQOeemMskf4EduJ472r+gKQFPUuUz2PQ1MHGLc5JTY9+c4PWc1tKCoAX5lHRBJd hJuJt7biEH2aCYcNCWQxGb8QJLNkEC0pCCq1TLgsYLgXSqF5Pmn61KB1tcCg1MF9ZNKebQKSx09Ni Gf89bZs7uZ7LpIX4vzOrszh3jJjGoVWAaMwujHcObVYUUtsXpWJp+Go/nVZatXw5bhaYpqBs961fm QjA8+B0qAbXyvcc9kiXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pO4AR-003jKG-DN; Fri, 03 Feb 2023 22:04:23 +0000 Received: from polaris.svanheule.net ([2a00:c98:2060:a004:1::200]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pO4A8-003j6b-1h for openwrt-devel@lists.openwrt.org; Fri, 03 Feb 2023 22:04:08 +0000 Received: from terra.lan (cust-41-49-110-94.dyn.as47377.net [94.110.49.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id A1BF63775D7; Fri, 3 Feb 2023 23:03:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1675461836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Ca/oooRGkRl304HKpEi1agSBOJpNjT5oBu6xdC9S9Y=; b=d1WF5TPBN2s5UV/GoLD8TSz7GTmhbFb/F63AdnRDNgRO1x9FBoviVd2UgDdYPwaKNPi2va BAXxq1EcUH0isoWORTNwksk9REYz62TMnwI/ojaKJiBTO9Jq+EppssssDJtc/VM+kjOWIH 7kp5HYammqAhyJQpmjUMRVzHgA8xa2YR0JxkLGhEUXbhEKmmhd3+C2OkLcoQBHbYDuJ0mE dxum63IsMFUodCRRlvCsf69z1H+A8pyDXPN1j8PbAgQU+Tw5e3eBZ3tGDR0+ECC+YVkr0I pbzUvMoJ+SLZSrR3UEBy0xDbLaWWN+y0H5qgmhepAepJgDKnSsW6FhmdTnLyQg== From: Sander Vanheule <sander@svanheule.net> To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule <sander@svanheule.net>, =?utf-8?q?Andreas_B=C3=B6hler?= <dev@aboehler.at> Subject: [PATCH firmware-utils v1 01/10] tplink-safeloader: stricter free_image_partition() Date: Fri, 3 Feb 2023 23:03:15 +0100 Message-Id: <ad13cbf655f1fdd1e9e704bf2ab1491a7ad9b082.1675461748.git.sander@svanheule.net> X-Mailer: git-send-email 2.39.0 In-Reply-To: <cover.1675461748.git.sander@svanheule.net> References: <cover.1675461748.git.sander@svanheule.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230203_140404_926689_EA5548E5 X-CRM114-Status: UNSURE ( 9.26 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Instead of only free()-ing the allocated data block, also clear the name and size of a payload entry to indicate that it's become invalid. Signed-off-by: Sander Vanheule <sander@svanheule.net> --- src/tplink-safeloader.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2a00:c98:2060:a004:1:0:0:200 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List <openwrt-devel.lists.openwrt.org> List-Unsubscribe: <https://lists.openwrt.org/mailman/options/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe> List-Archive: <http://lists.openwrt.org/pipermail/openwrt-devel/> List-Post: <mailto:openwrt-devel@lists.openwrt.org> List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help> List-Subscribe: <https://lists.openwrt.org/mailman/listinfo/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org> Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org |
Series |
Refactor image ingestion to support new formats
|
expand
|
diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c index d9e16058883c..6c4689c2f67c 100644 --- a/src/tplink-safeloader.c +++ b/src/tplink-safeloader.c @@ -3156,8 +3156,15 @@ static void set_partition_names(struct device_info *info) } /** Frees an image partition */ -static void free_image_partition(struct image_partition_entry entry) { - free(entry.data); +static void free_image_partition(struct image_partition_entry *entry) +{ + void *data = entry->data; + + entry->name = NULL; + entry->size = 0; + entry->data = NULL; + + free(data); } static time_t source_date_epoch = -1; @@ -3598,7 +3605,7 @@ static void build_image(const char *output, free(image); for (i = 0; parts[i].name; i++) - free_image_partition(parts[i]); + free_image_partition(&parts[i]); } /** Usage output */
Instead of only free()-ing the allocated data block, also clear the name and size of a payload entry to indicate that it's become invalid. Signed-off-by: Sander Vanheule <sander@svanheule.net> --- src/tplink-safeloader.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)