aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fortify2_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fortify2_test.cpp')
-rw-r--r--tests/fortify2_test.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/fortify2_test.cpp b/tests/fortify2_test.cpp
index 874eb1da1..b48a077bd 100644
--- a/tests/fortify2_test.cpp
+++ b/tests/fortify2_test.cpp
@@ -233,3 +233,29 @@ TEST(Fortify2_DeathTest, strcat_fortified) {
buf[0] = '\0';
ASSERT_EXIT(strcat(buf, src), testing::KilledBySignal(SIGABRT), "");
}
+
+TEST(Fortify2_DeathTest, memmove_fortified) {
+ ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+ char buf[20];
+ strcpy(buf, "0123456789");
+ size_t n = atoi("10");
+ ASSERT_EXIT(memmove(buf + 11, buf, n), testing::KilledBySignal(SIGABRT), "");
+}
+
+TEST(Fortify2_DeathTest, memcpy_fortified) {
+ ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+ char bufa[10];
+ char bufb[10];
+ strcpy(bufa, "012345678");
+ size_t n = atoi("11");
+ ASSERT_EXIT(memcpy(bufb, bufa, n), testing::KilledBySignal(SIGABRT), "");
+}
+
+TEST(Fortify2_DeathTest, strncpy_fortified) {
+ ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+ char bufa[15];
+ char bufb[10];
+ strcpy(bufa, "01234567890123");
+ size_t n = strlen(bufa);
+ ASSERT_EXIT(strncpy(bufb, bufa, n), testing::KilledBySignal(SIGABRT), "");
+}