diff --git a/cfg/posix.cfg b/cfg/posix.cfg index 35a2dd777..860a512c2 100644 --- a/cfg/posix.cfg +++ b/cfg/posix.cfg @@ -3396,17 +3396,21 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s Non reentrant function 'getpwuid' called. For threadsafe applications it is recommended to use the reentrant replacement function 'getpwuid_r'. - - + + + false - + + + + @@ -3416,6 +3420,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 f735a4b5c..482214d12 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -35,6 +35,17 @@ #include #include +int nullPointer_getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result) +{ + // cppcheck-suppress nullPointer + (void) getpwuid_r(uid, NULL, buffer, bufsize, result); + // cppcheck-suppress nullPointer + (void) getpwuid_r(uid, pwd, NULL, bufsize, result); + // cppcheck-suppress nullPointer + (void) getpwuid_r(uid, pwd, buffer, bufsize, NULL); + return getpwuid_r(uid, pwd, buffer, bufsize, result); +} + int nullPointer_getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result) { // cppcheck-suppress nullPointer