Both warnings are false positive, since opterrmsg buffer is controled solely by the warnx function and _vsnprintf appears to be zero-terminating its output as the documentation says. I've changed the fprintf call so it guards from a formatting string input to make V618 of the PVS Studio happy, manually zeroed the buffer before _vsnprintf call and limited it's output size to (buffer size - 1) to guarantee the output is always zero-terminated despite the implementation and suppressed the warning C6053 of the VS Code Analysis.
Both warnings are false positive, since
opterrmsg
buffer is controled solely by thewarnx
function and_vsnprintf
appears to be zero-terminating its output as the documentation says. I've changed thefprintf
call so it guards from a formatting string input to make V618 of the PVS Studio happy, manually zeroed the buffer before_vsnprintf
call and limited it's output size to (buffer size - 1) to guarantee the output is always zero-terminated despite the implementation and suppressed the warning C6053 of the VS Code Analysis.