Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170710020047.GL1627@brightrain.aerifal.cx>
Date: Sun, 9 Jul 2017 22:00:47 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] handle whitespace before %% in scanf

On Sun, Jul 09, 2017 at 11:00:18PM +0200, Bartosz Brachaczek wrote:
> this is mandated by C and POSIX standards and is in accordance with
  ^^^^
> glibc behavior.

Can you explain exactly what "this" refers to?

> ---
>  src/stdio/vfscanf.c  | 10 +++++++---
>  src/stdio/vfwscanf.c |  8 ++++++--
>  2 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c
> index d4d2454b..9e030fc4 100644
> --- a/src/stdio/vfscanf.c
> +++ b/src/stdio/vfscanf.c
> @@ -89,15 +89,19 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
>  			continue;
>  		}
>  		if (*p != '%' || p[1] == '%') {
> -			p += *p=='%';
>  			shlim(f, 0);
> -			c = shgetc(f);
> +			if (*p == '%') {
> +				p++;
> +				while (isspace((c=shgetc(f))));
> +			} else {
> +				c = shgetc(f);
> +			}

It looks like you're claiming %% consumes space, which I can't find
any support for in the C standard. Has this topic been discussed
somewhere I should see?

Rich

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.