On Tue, Nov 07, 2023 at 01:28:33PM +0100, Stefano Brivio wrote: > According to C99, 7.15.1: > > Each invocation of the va_start and va_copy macros shall be matched > by a corresponding invocation of the va_end macro in the same > function > > and the same applies to C11. I still have to come across a platform > where va_end() actually does something, but thus spake the standard. > This would be reported by Coverity as "Missing varargs init or > cleanup" (CWE-573). Oops. I'm pretty sure this one will cause real problems on some platforms. Well caught. > Fixes: c0426ff10bc9 ("log: Add vlogmsg()") > Signed-off-by: Stefano Brivio > --- > log.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/log.c b/log.c > index 95c4fa4..b206f72 100644 > --- a/log.c > +++ b/log.c > @@ -67,6 +67,8 @@ void vlogmsg(int pri, const char *format, va_list ap) > logfile_write(pri, format, ap2); > else if (!(setlogmask(0) & LOG_MASK(LOG_DEBUG))) > passt_vsyslog(pri, format, ap2); > + > + va_end(ap2); > } > > if ((setlogmask(0) & LOG_MASK(LOG_DEBUG) && log_file == -1) || -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson