gnu.cfg: Ensure a nullPointer warning is shown for invalid input to mempcpy() and wmempcpy().

This commit is contained in:
orbitcowboy 2022-04-21 09:19:32 +02:00
parent ce369c5122
commit 7c766a9696
1 changed files with 19 additions and 0 deletions

View File

@ -16,10 +16,29 @@
#include <sys/types.h> #include <sys/types.h>
#include <pwd.h> #include <pwd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <wchar.h>
#ifndef __CYGWIN__ #ifndef __CYGWIN__
#include <sys/epoll.h> #include <sys/epoll.h>
#endif #endif
void *nullPointer_mempcpy(void *dest, const void *src, size_t n)
{
// cppcheck-suppress nullPointer
(void) mempcpy(NULL,src,n);
// cppcheck-suppress nullPointer
(void) mempcpy(dest,NULL,n);
return mempcpy(dest,src,n);
}
wchar_t *nullPointer_wmempcpy(wchar_t *dest, const wchar_t *src, size_t n)
{
// cppcheck-suppress nullPointer
(void) wmempcpy(NULL,src,n);
// cppcheck-suppress nullPointer
(void) wmempcpy(dest,NULL,n);
return wmempcpy(dest,src,n);
}
int uninitvar_getpw(uid_t uid, char *buf) int uninitvar_getpw(uid_t uid, char *buf)
{ {
uid_t someUid; uid_t someUid;