From patchwork Tue Aug 31 09:09:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick X-Patchwork-Id: 1522503 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: 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=SyyS63Jk; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=systemli.org header.i=@systemli.org header.a=rsa-sha256 header.s=default header.b=btPozJmm; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GzLzQ6Ry2z9sW4 for ; Tue, 31 Aug 2021 19:11:46 +1000 (AEST) 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=Qyw1MDKYa9X9Y7YIg8cMbqvO0HwyDZeZLXSzHDEAx+Q=; b=SyyS63JkUwjmfP D6Vfz+VMVXzdKA9pLGVAwbT/5wpvLnlnPDoRGqfRkPf8bXeU5FfzjJLW6/efpRxbFtmMMYWYv0+C1 2OE4XK2jBctzX4Id5FHYBwfYl8uYXGuK1SZDMBhc7YUeN3z6WTJ9cGMrdhn0MBNbiOWX98BVrnUC8 4OMfPW0MH9KjPfyRSvrepKmb/FLcHjhHPsNQd1DPsv28cVZU2yHKmXb5g0JtsMiGnZ0veLKEUX+5p wtNxawKn6nzsCcp/ETgLnNMf11DNbZrCQjFSPfKRqUp/+LPIqSkSaPkyObwGrFqv1msAe5HSua35l +JaLcubGTTxfOdSc9rDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKzmA-001twL-Bm; Tue, 31 Aug 2021 09:09:50 +0000 Received: from mail1.systemli.org ([212.103.72.247]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKzlv-001trw-Nb for openwrt-devel@lists.openwrt.org; Tue, 31 Aug 2021 09:09:39 +0000 From: vincent@systemli.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=systemli.org; s=default; t=1630400967; bh=mBsfpmRgu92Hv3AcUXTNDV8+NjAxHgwtYVgnAP25UEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=btPozJmmO2tzr3mxM/0jIX5TBsvjEd6A75PmOOIDqmRaW01/eDX+nrrVNAZPc1R60 VFX+f4qRz/aPlMYkizb3FUA6KNG4Jf5CvfG/xNCP3zrYiXSLnyhwwpwlEBQsjL1Kvi 5Nt4wM5cqA4l27p6EXwB+4VFcluFO45UVIQSOOy+uc8SMp+ZBAlucEqZQ6GdnPiFDH NHuquv+X+sThTcX+hJCIm5qf0JijjYA3en9VX9ANtm+Vm5ehh27PhxM5fUZTIaqjvx YyryVuZY9pEIjfJpG0iAjAc9M4eehfNEv4D9tFU/3x9f6b0ma16i3yQmbhGzfL2Ttr TJ6XQm+S6MD5w== To: openwrt-devel@lists.openwrt.org Cc: Nick Hainke Subject: [PATCH 2/2] initd: fix off-by-one error in mkdev.c Date: Tue, 31 Aug 2021 11:09:19 +0200 Message-Id: <20210831090919.434244-2-vincent@systemli.org> In-Reply-To: <20210831090919.434244-1-vincent@systemli.org> References: <20210831090919.434244-1-vincent@systemli.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210831_020935_987286_E5576158 X-CRM114-Status: UNSURE ( 8.28 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) 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: From: Nick Hainke Substract 1 from bufsize so len can not be out of bounds. Same hanling as in "udevtrigger.c" in "sysfs_resolve_link". Replaces: 8eb1d783 Coverity CID: 1330087 Readlink used insecurely Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.103.72.247 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Nick Hainke Substract 1 from bufsize so len can not be out of bounds. Same hanling as in "udevtrigger.c" in "sysfs_resolve_link". Replaces: 8eb1d783 Coverity CID: 1330087 Readlink used insecurely Signed-off-by: Nick Hainke --- initd/mkdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/initd/mkdev.c b/initd/mkdev.c index 44101aa..f0a1e84 100644 --- a/initd/mkdev.c +++ b/initd/mkdev.c @@ -82,7 +82,7 @@ static void find_devs(bool block) continue; strcpy(path, dp->d_name); - len = readlink(buf2, buf, sizeof(buf)); + len = readlink(buf2, buf, sizeof(buf) - 1); if (len <= 0) continue;