You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ASSERT_EQUALS("[test.cpp:3:3]: (warning, inconclusive) The buffer 'c' may not be null-terminated after the call to strncpy(). [terminateStrncpy]\n", errout_str());
4727
+
4728
+
check("void foo() {\n"
4729
+
" char c[6];\n"
4730
+
" strncpy(&c, \"hello\\0\", 6);\n"
4731
+
"}");
4732
+
ASSERT_EQUALS("", errout_str());
4733
+
}
4734
+
4689
4735
voidrecursive_long_time() {
4690
4736
// Just test that recursive check doesn't take long time
4691
4737
check("char *f2 ( char *b )\n"
@@ -5714,45 +5760,6 @@ class TestBufferOverrun : public TestFixture {
5714
5760
"}", dinit(CheckOptions, $.s = &settings));
5715
5761
ASSERT_EQUALS("", errout_str());
5716
5762
}
5717
-
5718
-
voidgetBufferSizeOfAddressOfVariable() { // #7570
5719
-
5720
-
check("void f() {\n"
5721
-
" int i;\n"
5722
-
" memset(&i, 0, 1000);\n"
5723
-
"}");
5724
-
ASSERT_EQUALS("[test.cpp:3:10]: (error) Buffer is accessed out of bounds: &i [bufferAccessOutOfBounds]\n", errout_str());
5725
-
5726
-
check("void f() {\n"
5727
-
" int i[2];\n"
5728
-
" memset(&i, 0, 1000);\n"
5729
-
"}");
5730
-
ASSERT_EQUALS("[test.cpp:3:10]: (error) Buffer is accessed out of bounds: i [bufferAccessOutOfBounds]\n", errout_str());
5731
-
5732
-
check("void f() {\n"
5733
-
" int i;\n"
5734
-
" memset(&i, 0, sizeof(i));\n"
5735
-
"}");
5736
-
ASSERT_EQUALS("", errout_str());
5737
-
5738
-
check("void f() {\n"
5739
-
" int i[10];\n"
5740
-
" memset(&i[1], 0, 1000);\n"
5741
-
"}");
5742
-
TODO_ASSERT_EQUALS("[test.cpp:3:10]: (error) Buffer is accessed out of bounds: &i[1] [bufferAccessOutOfBounds]\n", "", errout_str());
5743
-
5744
-
check("void foo() {\n"
5745
-
" char c[6];\n"
5746
-
" strncpy(&c, \"hello!\", 6);\n"
5747
-
"}");
5748
-
ASSERT_EQUALS("[test.cpp:3:3]: (warning, inconclusive) The buffer 'c' may not be null-terminated after the call to strncpy(). [terminateStrncpy]\n", errout_str());
0 commit comments