From 8c2348c425ed0601c7b85ec5e1773c3184c8af0d Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 18 Jun 2023 23:51:44 +0200 Subject: [PATCH] libc/scanf: Skip whitespace before %% --- libc/src/scanf.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libc/src/scanf.cpp b/libc/src/scanf.cpp index 1a7d3f72..777096e1 100644 --- a/libc/src/scanf.cpp +++ b/libc/src/scanf.cpp @@ -72,7 +72,11 @@ extern "C" else { format++; - if (*format == '%') goto normal; + if (*format == '%') + { + str += strspn(str, " \t\f\r\n\v"); + goto normal; + } int flags = parse_flags(&format); size_t width = parse_width(&format, flags);