From 8834241417e67090c5185c37221118229b0b4c48 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 22 Apr 2025 09:55:38 +0300 Subject: [PATCH] LibC: Fix scanf %n modifier Old code was always returning off by one --- userspace/libraries/LibC/scanf_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userspace/libraries/LibC/scanf_impl.cpp b/userspace/libraries/LibC/scanf_impl.cpp index 9d0e11b9..d1ea5607 100644 --- a/userspace/libraries/LibC/scanf_impl.cpp +++ b/userspace/libraries/LibC/scanf_impl.cpp @@ -596,7 +596,7 @@ int scanf_impl(const char* format, va_list arguments, int (*__getc_fun)(bool adv } case 'n': if (!conversion.suppress) - *va_arg(arguments, int*) = nread - (in != NONE); + *va_arg(arguments, int*) = nread; conversion.suppress = true; // Dont count this as conversion result = ConversionResult::SUCCESS; break;