From 32dad3f44a322c6569681b25f1442c0692c0f7bd Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 6 Sep 2019 10:16:11 +0200 Subject: [PATCH] posix.cfg: Fix vsyslog() configuration (#2150) Add tests to make sure no false positives are reported. Found the issue via daca@home --- cfg/posix.cfg | 5 +++-- test/cfg/posix.c | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cfg/posix.cfg b/cfg/posix.cfg index 3c43eeba0..728f4f097 100644 --- a/cfg/posix.cfg +++ b/cfg/posix.cfg @@ -2165,15 +2165,16 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s false + - + - + diff --git a/test/cfg/posix.c b/test/cfg/posix.c index 3c82ecb6c..590e61ac2 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include void memleak_scandir(void) { @@ -53,11 +55,15 @@ void no_memleak_scandir(void) free(namelist); } -void validCode() +void validCode(va_list valist_arg1, va_list valist_arg2) { void *ptr; if (posix_memalign(&ptr, sizeof(void *), sizeof(void *)) == 0) free(ptr); + syslog(LOG_ERR, "err %u", 0U); + syslog(LOG_WARNING, "warn %d %d", 5, 1); + vsyslog(LOG_EMERG, "emerg %d", valist_arg1); + vsyslog(LOG_INFO, "test %s %d %p", valist_arg2); } void bufferAccessOutOfBounds(int fd)