From e6e3987935633664e59b87e8792535872f543515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 22 Dec 2018 20:40:47 +0100 Subject: [PATCH] snprintf/g_snprintf: do not allow uninitialized target buffer --- cfg/gtk.cfg | 17 ++++++++++++++++- cfg/std.cfg | 1 + test/cfg/std.c | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cfg/gtk.cfg b/cfg/gtk.cfg index f298758ef..4d4e8f3e3 100644 --- a/cfg/gtk.cfg +++ b/cfg/gtk.cfg @@ -2438,8 +2438,23 @@ false - + false + + + + + + + + 0: + + + + + + + diff --git a/cfg/std.cfg b/cfg/std.cfg index 830ccfc95..4f17c2508 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -5813,6 +5813,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun false + diff --git a/test/cfg/std.c b/test/cfg/std.c index 08adb2c11..c1a512f02 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -3527,7 +3527,7 @@ void uninitvar_snprintf(char *S, size_t N, char *Format, int Int) (void)snprintf(S,N,format,Int); // format is uninitialized // cppcheck-suppress uninitvar (void)snprintf(S,N,Format,i); // i is uninitialized - // TODO cppcheck-suppress uninitvar + // cppcheck-suppress uninitvar (void)snprintf(s,N,Format,Int); // no warning is expected for