diff --git a/cfg/posix.cfg b/cfg/posix.cfg
index bb7f70ca3..d4e8e5ce6 100644
--- a/cfg/posix.cfg
+++ b/cfg/posix.cfg
@@ -4723,6 +4723,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
+
diff --git a/test/cfg/posix.c b/test/cfg/posix.c
index 49775acce..f5a79b346 100644
--- a/test/cfg/posix.c
+++ b/test/cfg/posix.c
@@ -48,6 +48,15 @@ int nullPointer_wcsnlen(const wchar_t *s, size_t n)
return wcsnlen(s, n);
}
+size_t bufferAccessOutOfBounds_wcsnlen(const wchar_t *s, size_t maxlen)
+{
+ wchar_t buf[2]={L'4',L'2'};
+ size_t len = wcsnlen(buf,2);
+ // TODO cppcheck-suppress bufferAccessOutOfBounds
+ len+=wcsnlen(buf,3);
+ return len;
+}
+
int nullPointer_gethostname(char *s, size_t n)
{
// cppcheck-suppress nullPointer
@@ -272,6 +281,23 @@ void bufferAccessOutOfBounds_bzero(void *s, size_t n)
bzero(s,n);
}
+size_t bufferAccessOutOfBounds_strnlen(const char *s, size_t maxlen)
+{
+ char buf[2]={'4','2'};
+ size_t len = strnlen(buf,2);
+ // cppcheck-suppress bufferAccessOutOfBounds
+ len+=strnlen(buf,3);
+ return len;
+}
+
+size_t nullPointer_strnlen(const char *s, size_t maxlen)
+{
+ // No warning shall be shown:
+ (void) strnlen(s, maxlen);
+ // cppcheck-suppress nullPointer
+ return strnlen(NULL, maxlen);
+}
+
char * nullPointer_stpcpy(char *src, char *dest)
{
// No warning shall be shown: