libc: enable FORTIFY_SOURCE snprintf under clang
Change-Id: I8b8059782a720104722b0841994b38f873ed02aa
diff --git a/tests/fortify1_test_clang.cpp b/tests/fortify1_test_clang.cpp
index b4ded33..9f5b8b5 100644
--- a/tests/fortify1_test_clang.cpp
+++ b/tests/fortify1_test_clang.cpp
@@ -157,6 +157,15 @@
ASSERT_EXIT(strncpy(bufb, bufa, n), testing::KilledBySignal(SIGABRT), "");
}
+TEST(Fortify1_Clang_DeathTest, snprintf_fortified) {
+ ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+ char bufa[15];
+ char bufb[10];
+ strcpy(bufa, "0123456789");
+ size_t n = strlen(bufa) + 1;
+ ASSERT_EXIT(snprintf(bufb, n, "%s", bufa), testing::KilledBySignal(SIGABRT), "");
+}
+
extern "C" char* __strncat_chk(char*, const char*, size_t, size_t);
extern "C" char* __strcat_chk(char*, const char*, size_t);