diff --git a/test/cfg/std.c b/test/cfg/std.c index 75aad265f..a6c9be4e3 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -85,6 +85,26 @@ void bufferAccessOutOfBounds(void) free(pAlloc1); } +wchar_t* nullPointer_fgetws(wchar_t* buffer, int n, FILE* stream) +{ + // cppcheck-suppress nullPointer + (void)fgetws(NULL,n,stream); + // cppcheck-suppress nullPointer + (void)fgetws(buffer,n,NULL); + // No warning is expected + return fgetws(buffer, n, stream); +} + +char* nullPointer_fgets(char *buffer, int n, FILE *stream) +{ + // cppcheck-suppress nullPointer + (void)fgets(NULL,n,stream); + // cppcheck-suppress nullPointer + (void)fgets(buffer,n,NULL); + // No warning is expected + return fgets(buffer, n, stream); +} + void memleak_aligned_alloc(void) { // cppcheck-suppress unusedAllocatedMemory diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index cff83ed30..90eb7a7f4 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -1264,6 +1264,26 @@ void uninitvar_fsetpos(void) (void)std::fsetpos(stream,ptr); } +wchar_t* nullPointer_fgetws(wchar_t* buffer, int n, FILE* stream) +{ + // cppcheck-suppress nullPointer + (void)std::fgetws(NULL,n,stream); + // cppcheck-suppress nullPointer + (void)std::fgetws(buffer,n,NULL); + // No warning is expected + return std::fgetws(buffer, n, stream); +} + +char* nullPointer_fgets(char *buffer, int n, FILE *stream) +{ + // cppcheck-suppress nullPointer + (void)std::fgets(NULL,n,stream); + // cppcheck-suppress nullPointer + (void)std::fgets(buffer,n,NULL); + // No warning is expected + return std::fgets(buffer, n, stream); +} + void uninitvar_fgets(void) { char *buffer;