Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b0f9d8e0-1125-f438-a942-79c97713d2e3@mirbsd.de>
Date: Wed, 8 Oct 2025 05:04:48 +0200 (CEST)
From: Thorsten Glaser <tg@...bsd.de>
To: raf <musl@....org>
cc: musl@...ts.openwall.com
Subject: Re: [PATCH] fnmatch: fix infinite loop when pattern is
 non-character byte

On Wed, 8 Oct 2025, raf wrote:

>-		for (p=pat; (c=pat_next(p, -1, &inc, flags))!=END && c!='/'; p+=inc);
>+		for (p=pat; (c=pat_next(p, -1, &inc, flags))!=END && c!=UNMATCHABLE && c!='/'; p+=inc);
>+		if (c == UNMATCHABLE)
>+			return FNM_NOMATCH;

This would have been a *wonderful* chance to clean up that absolute
footgun of a loop construct (the semicolon even trailing and with
no comment):

		for (p = pat; (c = pat_next(p, -1, &inc, flags)) != END && c != '/'; p += inc)
			if (c == UNMATCHABLE)
				return (FNM_NOMATCH);

Just my impression on casual looking at that diff (from outside),
//mirabilos
-- 
Sometimes they [people] care too much: pretty printers [and syntax highligh-
ting, d.A.] mechanically produce pretty output that accentuates irrelevant
detail in the program, which is as sensible as putting all the prepositions
in English text in bold font.	-- Rob Pike in "Notes on Programming in C"

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.