LibC: Fix printf %c modifier for null byte

This commit is contained in:
Bananymous 2025-05-28 02:43:17 +03:00
parent f55d6b11c5
commit 7691b019e2
1 changed files with 2 additions and 1 deletions

View File

@ -552,6 +552,7 @@ extern "C" int printf_impl(const char* format, va_list arguments, int (*putc_fun
conversion[0] = va_arg(arguments, int); conversion[0] = va_arg(arguments, int);
conversion[1] = '\0'; conversion[1] = '\0';
string = conversion; string = conversion;
length = 1;
format++; format++;
break; break;
} }
@ -633,7 +634,7 @@ extern "C" int printf_impl(const char* format, va_list arguments, int (*putc_fun
for (int i = length; i < options.width; i++) for (int i = length; i < options.width; i++)
BAN_PRINTF_PUTC(' '); BAN_PRINTF_PUTC(' ');
for (int i = 0; i < length && string[i]; i++) for (int i = 0; i < length; i++)
BAN_PRINTF_PUTC(string[i]); BAN_PRINTF_PUTC(string[i]);
if (options.left_justified) if (options.left_justified)