bdk: sprintf: do not accept null chars

Skip NULL chars on putc since they break the resulted string.
This commit is contained in:
CTCaer 2024-01-06 21:52:48 +02:00
parent 92093ff08e
commit dab5eb9aa0

View file

@ -112,7 +112,9 @@ void s_printf(char *out_buf, const char *fmt, ...)
switch (*fmt) switch (*fmt)
{ {
case 'c': case 'c':
_s_putc(va_arg(ap, u32)); char c = va_arg(ap, u32);
if (c != '\0')
_s_putc(c);
break; break;
case 's': case 's':
_s_puts(va_arg(ap, char *)); _s_puts(va_arg(ap, char *));