rtld snprintf: do not erronously skip a char at the buffer boundary

(cherry picked from commit 56ee5fc43c)
This commit is contained in:
Konstantin Belousov 2024-04-28 09:37:24 +03:00
parent cf2750be9e
commit d9ec850bde

View file

@ -81,11 +81,10 @@ snprintf_func(int ch, struct snprintf_arg *const info)
}
break;
case PRINT_METHOD_WRITE:
if (info->remain > 0) {
*info->str++ = ch;
info->remain--;
} else
if (info->remain == 0)
printf_out(info);
*info->str++ = ch;
info->remain--;
break;
}
}