diff --git a/cfg/std.cfg b/cfg/std.cfg
index 86ecac53f..7bd1b2a07 100644
--- a/cfg/std.cfg
+++ b/cfg/std.cfg
@@ -466,9 +466,11 @@
+
+ 0:
@@ -1604,6 +1606,7 @@
false
+
@@ -1900,6 +1903,7 @@
+
diff --git a/test/cfg/std.c b/test/cfg/std.c
index 408c98fd8..337d0efc3 100644
--- a/test/cfg/std.c
+++ b/test/cfg/std.c
@@ -292,7 +292,7 @@ void nullpointer(int value)
fclose(fp);
fp = 0;
// No FP
- fflush(0);
+ fflush(0); // If stream is a null pointer, all streams are flushed.
fp = freopen(0,"abc",stdin);
fclose(fp);
fp = NULL;
@@ -435,6 +435,15 @@ void nullPointer_wcsftime(wchar_t* ptr, size_t maxsize, const wchar_t* format, c
(void)wcsftime(ptr, maxsize, format, timeptr);
}
+void bufferAccessOutOfBounds_wcsftime(wchar_t* ptr, size_t maxsize, const wchar_t* format, const struct tm* timeptr)
+{
+ wchar_t buf[42];
+ (void)wcsftime(buf, 42, format, timeptr);
+ // TODO cppcheck-suppress bufferAccessOutOfBounds
+ (void)wcsftime(buf, 43, format, timeptr);
+ (void)wcsftime(ptr, maxsize, format, timeptr);
+}
+
int nullPointer_wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n)
{
// cppcheck-suppress nullPointer
@@ -1578,6 +1587,14 @@ void uninitvar_fmod(void)
(void)fmodl(ld1,ld2);
}
+void nullPointer_fprintf(FILE *Stream, char *Format, int Argument)
+{
+ // cppcheck-suppress nullPointer
+ (void)fprintf(Stream, NULL, Argument);
+ // no warning is expected
+ (void)fprintf(Stream, Format, Argument);
+}
+
void uninitvar_fprintf(FILE *Stream, char *Format, int Argument)
{
FILE *stream1, *stream2;
diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp
index 174b700ed..890a1737a 100644
--- a/test/cfg/std.cpp
+++ b/test/cfg/std.cpp
@@ -63,6 +63,23 @@ void invalidFunctionArg_fetestexcept(int excepts)
(void)std::fetestexcept(FE_ALL_EXCEPT+1);
}
+void nullPointer_fprintf(FILE *Stream, char *Format, int Argument)
+{
+ // cppcheck-suppress nullPointer
+ (void)std::fprintf(Stream, nullptr, Argument);
+ // no warning is expected
+ (void)std::fprintf(Stream, Format, Argument);
+}
+
+void bufferAccessOutOfBounds_wcsftime(wchar_t* ptr, size_t maxsize, const wchar_t* format, const struct tm* timeptr)
+{
+ wchar_t buf[42];
+ (void)std::wcsftime(buf, 42, format, timeptr);
+ // TODO cppcheck-suppress bufferAccessOutOfBounds
+ (void)std::wcsftime(buf, 43, format, timeptr);
+ (void)std::wcsftime(ptr, maxsize, format, timeptr);
+}
+
int qsort_cmpfunc (const void * a, const void * b) {
return (*static_cast(a) - *static_cast(b));
}