diff --git a/cfg/gnu.cfg b/cfg/gnu.cfg index 7ad7a6c5f..223caef2f 100644 --- a/cfg/gnu.cfg +++ b/cfg/gnu.cfg @@ -705,6 +705,19 @@ + + + false + + + + + + + + 0: + + close epoll_create diff --git a/cfg/posix.cfg b/cfg/posix.cfg index 0880b18a2..c45217e3b 100644 --- a/cfg/posix.cfg +++ b/cfg/posix.cfg @@ -3849,6 +3849,19 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s false + + + false + + + + + + + + 1: + + strdup strndup diff --git a/test/cfg/gnu.c b/test/cfg/gnu.c index 3460b8766..8b1127762 100644 --- a/test/cfg/gnu.c +++ b/test/cfg/gnu.c @@ -9,6 +9,15 @@ #include +void bufferAccessOutOfBounds() +{ + char buf[2]; + // This is valid + sethostname(buf, 2); + // cppcheck-suppress bufferAccessOutOfBounds + sethostname(buf, 4); +} + void leakReturnValNotUsed() { // cppcheck-suppress unreadVariable diff --git a/test/cfg/posix.c b/test/cfg/posix.c index 7e711f16d..8a04de4ed 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -48,6 +48,10 @@ void bufferAccessOutOfBounds(int fd) readlinkat(1, "path", a, 5); // cppcheck-suppress bufferAccessOutOfBounds readlinkat(1, "path", a, 6); + // This is valid + gethostname(a, 5); + // cppcheck-suppress bufferAccessOutOfBounds + gethostname(a, 6); } void nullPointer(char *p, int fd)