Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 27 Aug 2021 12:59:18 -0400
From: Rich Felker <dalias@...c.org>
To: Érico Nogueira <ericonr@...root.org>
Cc: musl@...ts.openwall.com, Alyssa Ross <hi@...ssa.is>
Subject: Re: [PATCH musl 3/3] mntent: fix parsing lines with optional
 fields

On Fri, Aug 27, 2021 at 12:49:28PM -0400, Rich Felker wrote:
> On Fri, Aug 27, 2021 at 12:27:36PM -0300, Érico Nogueira wrote:
> > Try avoiding unrelated changes in the commit, since they can introduce
> > subtle bugs. In this case, making n size_t[] instead of int[] will lead
> > to pointer type mismatches in the sscanf call, given that %n expects an
> > int*.
> > 
> > I don't know if *scanf guarantees it won't read enough to go past
> 
> For *scanf in general there is no such guarantee; not even size_t is
> safe for fscanf. However, here you have sscanf and the number is
> bounded by strlen(linebuf).
> 
> > INT_MAX, though, so making a change to size_t[] and using %ln might make
> > sense. Deferring to someone else to answer that.
> 
> The conversion specifier for size_t is %zu not %ln. Since in theory
> strlen(linebuf) could be more than INT_MAX, I think this change should
> be made, but it should be a separate bugfix.

Sorry, that should be '%zn'. '%zu' of course is for reading an integer
of type size_t not counting the bytes processed.

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.