On Sat, 17 Apr 2021, David Laight wrote:
In patch 2, vscnprintf should probably be used to make sure it's 0 terminated.
Why? C99 has this[1]:
"The vsnprintf function is equivalent to snprintf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls)."
vscnprintf() is normally the function you want (not vsnprintf()) because the return value is the number of characters actually put into the buffer, not the number that would have been written had the buffer been long enough.
Good catch, thank you! I'll respin the series then. Thank you for the background story too!
Maciej