Message ID | 20230131151431.15949-1-ansuelsmth@gmail.com |
---|---|
State | Accepted |
Delegated to: | Ansuel Smith |
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=MnajB7aV; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=XMIHXMvt; 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 4P5pZZ4stbz23gV for <incoming@patchwork.ozlabs.org>; Wed, 1 Feb 2023 02:17:42 +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: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:In-Reply-To:References: List-Owner; bh=E0lMbIrOiC13+D3d9FGxc5ioXwOBkFKbllcs8j6tJwQ=; b=MnajB7aVI3R2cQ Nm/0ZnHvqmaQXFomff7j+ZceHQW6kxeRh0xdYEDqtSYGQNlxPFYUylkjJBld0lgg6eTaTVhdi+MPt QstAXffvuzgl7BCz457XWIwpcw3gaRN+OFnNQhhKZ6nVOFYwSPilABFZIF2eitAdJURfHXHL1ELaN jfui8X6+iySnkQXqzRCTUKIZE3pvFg5FQTgAb7pW4g19OWagKkSoUP0F9eWRJoIYKUqSED9FNeVuY 3x3YYhXjTmaB5D9ZjeZwvqGv101Yj8qBIZJjDxSW0+hF2ihD3tpBSAeXsNzmTodilhOV3yTKIzLDu YNQ82EkEBxkwII8TjpIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMsLb-008SNt-Uw; Tue, 31 Jan 2023 15:15:00 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMsLQ-008SMM-6n for openwrt-devel@lists.openwrt.org; Tue, 31 Jan 2023 15:14:49 +0000 Received: by mail-wr1-x432.google.com with SMTP id q10so14530502wrm.4 for <openwrt-devel@lists.openwrt.org>; Tue, 31 Jan 2023 07:14:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+dshQu+tzv+1hl+T4UOr0shPrgCPYAKNq8jlPZ4qLQU=; b=XMIHXMvtea7bj2AlkR2H0iS2BtVbNtFsN0agjKGaZlj0BSbbSLQ3nZ7s4x4ql7uzBt qo7YcHt0kxTm/oLEU3JjDSHobAv2bYSQfXEkL0YBoRj2XQWhxmPNgenEephtLXNXrkxr daX0bPriSxlK5aViZuH2bgYTJBYMY4VTa09qv/2n4JULCs2X6E69TFS2TQtw97vkaxX+ QHW0TQ069dpvMIKQp3sv7HTSDZ/ORaLX0L67EmbcLPrFQW8h8e3GaOKz+anTYEURxKeG 6QWDkFSUSE0rCusC23WJUKIioA/bqv7jtFbOb9zwC18d5tuwSaq0lvOHLKPTEA9mtEOr 5dEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=+dshQu+tzv+1hl+T4UOr0shPrgCPYAKNq8jlPZ4qLQU=; b=dQSDgxpuGh34X6WiyC4VOaSqdZbKfPJ7tut9gEdPl37M/xYi50sEdUMkUYkhl9LgZX S2Mhp/mkLfF3Q9g+Pt8DzkXs3QonaKXMDIkn6axBvc4QO8IABFDA5xgQRfcHJ06ySC71 wh1rJbR1RxKZV/jzNvK8VvV7ZOW5QEyvo9VM2/IFBBIw1VsvCDRhpxthPk1DJb7I9k01 FUNGxeOFYrgeWHT6T79jSCngHmC+0FjIt8LD5lxWZdDz5WDN+NMKM9IMPvbL0WEKw/on EEgjddd3gQ/KbwJOzpCkBiPj1HDAakHGJHH2ZCKHUlgwD44ASVnBUz2n96VJ/jIYYnem wOcw== X-Gm-Message-State: AO0yUKW1yu0K8QZHMJO/5C/jB8XZK1inhk/uGA+aiML5Yc7rQzzVoZFb EgBA9Jp5h8YuMte4atAtN8Y= X-Google-Smtp-Source: AK7set8KLMR3XWO61GYZIiJNYu5YfNLL2Vjv5p5zrnfhWpxkcbz5lAxpl7YTKeGH1wJpMWgsPwroUQ== X-Received: by 2002:adf:f70e:0:b0:2bf:de0b:7009 with SMTP id r14-20020adff70e000000b002bfde0b7009mr10952461wrp.23.1675178084195; Tue, 31 Jan 2023 07:14:44 -0800 (PST) Received: from localhost.localdomain (93-34-88-241.ip49.fastwebnet.it. [93.34.88.241]) by smtp.googlemail.com with ESMTPSA id z2-20020a5d6542000000b00267bcb1bbe5sm14942811wrv.56.2023.01.31.07.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 07:14:43 -0800 (PST) From: Christian Marangi <ansuelsmth@gmail.com> To: Jo-Philipp Wich <jo@mein.io>, OpenWrt Development List <openwrt-devel@lists.openwrt.org> Cc: Christian Marangi <ansuelsmth@gmail.com> Subject: [rpcd PATCH 1/4] rc: fix and improve script scanning START and STOP Date: Tue, 31 Jan 2023 16:14:28 +0100 Message-Id: <20230131151431.15949-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230131_071448_271424_3ADD86B5 X-CRM114-Status: GOOD ( 13.19 ) 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: Currently we stop searching at the first occurence of START or STOP entry. This is wrong since we totally miss the other data (START or STOP) in the occurence of the other. Fix and improve script scanning by: - Increase the line max length to 255 char to read it in one go. - Scan only the first 10 lines. - Don't stop at the first occurence and try to search also for the [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:432 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth[at]gmail.com] -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 |
[rpcd,1/4] rc: fix and improve script scanning START and STOP
|
expand
|
diff --git a/rc.c b/rc.c index 45fdc1a..431d3a5 100644 --- a/rc.c +++ b/rc.c @@ -187,17 +187,20 @@ static void rc_list_readdir(struct rc_list_context *c) if (fp) { struct stat s; char path[PATH_MAX]; - char line[32]; + char line[255]; bool beginning; + int count = 0; beginning = true; - while (c->entry.start < 0 && c->entry.stop < 0 && fgets(line, sizeof(line), fp)) { + while ((c->entry.start < 0 || c->entry.stop < 0) && + count <= 10 && fgets(line, sizeof(line), fp)) { if (beginning) { if (!strncmp(line, "START=", 6)) { c->entry.start = strtoul(line + 6, NULL, 0); } else if (!strncmp(line, "STOP=", 5)) { c->entry.stop = strtoul(line + 5, NULL, 0); } + count++; } beginning = !!strchr(line, '\n');
Currently we stop searching at the first occurence of START or STOP entry. This is wrong since we totally miss the other data (START or STOP) in the occurence of the other. Fix and improve script scanning by: - Increase the line max length to 255 char to read it in one go. - Scan only the first 10 lines. - Don't stop at the first occurence and try to search also for the other data. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> --- rc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)