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 33cac296a2
commit 44debee9fc

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;
}
}