From: Rich Felker <firstname.lastname@example.org>
To: "Érico Nogueira" <email@example.com>
Cc: firstname.lastname@example.org, Alyssa Ross <email@example.com>
Subject: Re: [musl] [PATCH musl 3/3] mntent: fix parsing lines with optional fields
Date: Fri, 27 Aug 2021 12:59:18 -0400 [thread overview]
Message-ID: <20210827165916.GX13220@brightrain.aerifal.cx> (raw)
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.
prev parent reply other threads:[~2021-08-27 16:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-21 8:54 [musl] [PATCH 0/3] " Alyssa Ross
2021-08-21 8:54 ` [musl] [PATCH libc-test 1/3] functional: add mntent test Alyssa Ross
2021-08-21 8:54 ` [musl] [PATCH libc-test 2/3] functional: add mntent test for single-field line Alyssa Ross
2021-08-21 8:54 ` [musl] [PATCH musl 3/3] mntent: fix parsing lines with optional fields Alyssa Ross
2021-08-27 15:27 ` Érico Nogueira
2021-08-27 16:49 ` Rich Felker
2021-08-27 16:59 ` Rich Felker [this message]
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).