From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 261602ED39 for ; Sat, 19 Oct 2024 20:14:36 +0200 (CEST) Received: (qmail 3969 invoked by uid 550); 19 Oct 2024 18:14:30 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com x-ms-reactions: disallow Received: (qmail 3916 invoked from network); 19 Oct 2024 18:14:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=fm1; t=1729361661; x=1729448061; bh=bpu7YlRJTGN6hLTbTXHjI FrSDInuspchSl/v5Na3GJ4=; b=VHmNCB5Pa48Rwykw715xwD0aJc9NngMIjCgED OrOPyBKmfTmteRi6IPOAYFm3Pm+OI8owgamhrbs207OSdaGeev7TeAGLCzbc/Os2 rABPzso5PoEybwkdzPdjLgebT28AV6XTS0Tr+n5QUHFqGdGwEMbYVMZmLUZfmHXR Qk97qffpKduRrqzDYpjXOwQicK+O9KcIg7qze9J65Eg6tX/D3XrTDhzYakCV0QlI Riy6MaoqfzEGfJjHo3hr0ps6Jj51JRLuS/etQWNEUl6u1dmTmkviAv80gmV7uOy/ vI6JSRSVib8MzUdTmAzgibZqnoNqCUq0CZ6DUll0iDk8ohM6w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1729361661; x=1729448061; bh=bpu7YlRJTGN6hLTbTXHjIFrSDInu spchSl/v5Na3GJ4=; b=QulR4cNJVS7GN75zcpAH6xEkcTvEKazFIFK3nui5I8YF /WlP7kKQKyDLm54abnJAN8rJ/OMCV3wBnb9yGKZtgH49RYoMiQaqVwktC8dAgDhW vXae4uxnABg5iQiODSDV6M88x5eEJAVUh5OBo6bJToHF+J6K9fClcC2DuF6OBnti VjhsNoE/engepg2JwRdo2kx7byChnTbiIfJwqoTqbAygdUq+d4QUjG8UoUgVO8Hs MqI54tG2bywcGZ8YjUaOrKRB6Ssogp9R70wUxEG+2Kaezfb/0YuTYKpFbmTRARLD Y1ZL5eB3vptvkPbHtE3fc/Hpv1EWtBsHrKnSYtAKpQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehhedguddvhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvuf ffkffoggfgsedtkeertdertddtnecuhfhrohhmpeetlhihshhsrgcutfhoshhsuceohhhi segrlhihshhsrgdrihhsqeenucggtffrrghtthgvrhhnpeehvdffgffhteeijefgteeftd fghfdvheeuhedvjedugfeggfeljefgleefvefgfeenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehhihesrghlhihsshgrrdhishdpnhgspghrtg hpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhhushhlsehlihhs thhsrdhophgvnhifrghllhdrtghomh X-ME-Proxy: Feedback-ID: i12284293:Fastmail From: Alyssa Ross To: musl@lists.openwall.com Date: Sat, 19 Oct 2024 20:13:21 +0200 Message-ID: <20241019181320.23977-2-hi@alyssa.is> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH] mntent: exclude trailing newline from parsed field When the pattern was changed from matching any whitespace to just matching spaces and tabs, a newline started being appended to the value of the matched field, if that field was a string. For example, in a 4-field line, the mnt_opts field would have a newline on the end. This happened because a newline is not a space or a tab, and so was matched as part of the value before the end of the string was reached. \n should therefore be added as a character that terminates a value. This shouldn't interfere with the intention of the change to space and tab only, as it was trying to make sure that other whitespace like carriage returns, that should have been part of parsed values, were. Fixes: f314e133 ("mntent: fields are delimited only by tabs or spaces, not general whitespace") --- The mntent tests I wrote for libc-test never got applied, but would have caught this regression. I'll resend those. src/misc/mntent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc/mntent.c b/src/misc/mntent.c index 78bf0cd0..ee17a69f 100644 --- a/src/misc/mntent.c +++ b/src/misc/mntent.c @@ -81,7 +81,7 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle len = strlen(linebuf); if (len > INT_MAX) continue; for (i = 0; i < sizeof n / sizeof *n; i++) n[i] = len; - sscanf(linebuf, " %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %d %d", + sscanf(linebuf, " %n%*[^ \t\n]%n %n%*[^ \t\n]%n %n%*[^ \t\n]%n %n%*[^ \t\n]%n %d %d", n, n+1, n+2, n+3, n+4, n+5, n+6, n+7, &mnt->mnt_freq, &mnt->mnt_passno); } while (linebuf[n[0]] == '#' || n[1]==len); base-commit: dd1e63c3638d5f9afb857fccf6ce1415ca5f1b8b -- 2.46.0