[PATCH] Fix %Z parsing in strptime [BZ #16088]
Andreas Schwab
schwab@suse.de
Thu Jun 22 15:21:36 GMT 2023
On Jun 22 2023, Stanley Lancaster via Libc-alpha wrote:
> %Z parsing terminated on space, should've terminated on next character in format string
>
> Author: Stanley Lancast <lancasterharp@gmail.com>
> ---
> time/strptime_l.c | 5 +++--
> time/tst-strptime.c | 1 +
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/time/strptime_l.c b/time/strptime_l.c
> index 85c3249fcc..5f96795406 100644
> --- a/time/strptime_l.c
> +++ b/time/strptime_l.c
> @@ -772,8 +772,9 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tmp,
> /* Read timezone but perform no conversion. */
> while (ISSPACE (*rp))
> rp++;
> - while (!ISSPACE (*rp) && *rp != '\0')
> - rp++;
> +
> + while (*rp != *(fmt) && *rp != '\0')
> + rp++;
The next character could be '%'.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
More information about the Libc-alpha
mailing list