mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jens Gustedt <jens.gustedt@inria.fr>
To: musl@lists.openwall.com
Subject: Re: [PATCH] handle whitespace before %% in scanf
Date: Mon, 10 Jul 2017 16:44:45 +0200	[thread overview]
Message-ID: <20170710164445.53ef621d@inria.fr> (raw)
In-Reply-To: <c2c7d1ce-1e0d-a504-f8be-313fe7385240@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]

Hello Bartosz,

On Mon, 10 Jul 2017 10:22:37 +0200 Bartosz Brachaczek
<b.brachaczek@gmail.com> wrote:

> > EXAMPLE 5 The call:
> > 
> >     #include <stdio.h>
> >     /* ... */
> >     int n, i;
> >     n = sscanf("foo % bar 42", "foo%%bar%d", &i);
> > 
> > will assign to 'n' the value 1 and to 'i' the value 42 because input
> > white-space characters are skipped for both the '%' and 'd'
> > conversion specifiers.  
> 
> Now, the code in the example is clearly broken, as either the format 
> string should be "foo%% bar%d" or the input string should be
> "foo %bar 42", but the explanation does imply that '%%' consumes
> whitespace.

Yes, I have noted this as an editorial fix for C17

Thanks for reporting
Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2017-07-10 14:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-09 21:00 Bartosz Brachaczek
2017-07-10  2:00 ` Rich Felker
2017-07-10  8:22   ` Bartosz Brachaczek
2017-07-10 14:44     ` Jens Gustedt [this message]
2017-07-10 20:59       ` Rich Felker
2017-09-04 22:00       ` Bartosz Brachaczek
2017-09-04 22:57         ` Jens Gustedt
2017-07-11  1:20 ` Rich Felker
2017-09-04 20:59   ` Rich Felker
2017-09-04 21:56     ` Bartosz Brachaczek

Reply instructions:

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170710164445.53ef621d@inria.fr \
    --to=jens.gustedt@inria.fr \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.vuxu.org/mirror/musl/

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).