diff --git a/cfg/std.cfg b/cfg/std.cfg index dabafd94b..747ce8636 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -5298,11 +5298,6 @@ false - - - - - diff --git a/samples/outOfBounds/bad.c b/samples/outOfBounds/bad.c index 297020b6c..b34db614c 100644 --- a/samples/outOfBounds/bad.c +++ b/samples/outOfBounds/bad.c @@ -2,5 +2,5 @@ int main() { char str[5]; - snprintf(str, 10, "%s", "0123456789abcdef"); + strcpy(str, "0123456789abcdef"); } diff --git a/test/cfg/posix.c b/test/cfg/posix.c index 40efd4a5b..9f9da1207 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -143,9 +143,6 @@ void uninitvar(int fd) { pattern=""; // cppcheck-suppress uninitvar regcomp(®, pattern, cflags); - cflags=42; - // cppcheck-suppress uninitvar - regcomp(®, pattern, cflags); } void uninitvar_types(void) { diff --git a/test/cfg/std.c b/test/cfg/std.c index dd44f26f4..841f6f1ed 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -21,8 +21,7 @@ void bufferAccessOutOf(void) { // cppcheck-suppress bufferAccessOutOfBounds sprintf(a, "ab%s", "cde"); snprintf(a, 5, "abcde%i", 1); - // cppcheck-suppress bufferAccessOutOfBounds - snprintf(a, 6, "abcde%i", 1); + snprintf(a, 6, "abcde%i", 1); //TODO: cppcheck-suppress bufferAccessOutOfBounds strcpy(a,"abcd"); // cppcheck-suppress bufferAccessOutOfBounds strcpy(a, "abcde"); @@ -126,6 +125,10 @@ void nullpointer(int value){ strxfrm(0,"foo",0); // TODO: error message strxfrm(0,"foo",42); + + snprintf(NULL, 0, "someformatstring"); // legal + // cppcheck-suppress nullPointer + snprintf(NULL, 42, "someformatstring"); // not legal } void nullpointerMemchr1(char *p, char *s) {