[PATCH master 7/8] vsprintf: fix left indentation when formatting wide string arguments

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Mar 19 22:16:40 PDT 2025


leading_spaces will advance the buf pointer as needed, but currently buf
is never reassigned, breaking formatting of wchar arrays.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
  - new patch
---
 lib/vsprintf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index cb42caebca16..99c63fbc33c7 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -229,7 +229,8 @@ static char *wstring(char *buf, const char *end, const wchar_t *s, int field_wid
 		s = L"<NULL>";
 
 	len = wcsnlen(s, precision);
-	leading_spaces(buf, end, len, &field_width, flags);
+
+	buf = leading_spaces(buf, end, len, &field_width, flags);
 
 	for (i = 0; i < len; ++i) {
 		if (buf < end)
-- 
2.39.5




More information about the barebox mailing list