aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fortify2_test_clang.cpp
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2013-06-25 10:02:35 -0700
committerNick Kralevich <nnk@google.com>2013-06-25 10:02:35 -0700
commit621b19dddbfba1cd98c01cb95ce312baa20e0e7c (patch)
treecf8335801d54362b0e7c3e032c4f35a46d017e2f /tests/fortify2_test_clang.cpp
parent1642edb5208fe02ef64d5734fffaf7c4a724fd2f (diff)
downloadandroid_bionic-621b19dddbfba1cd98c01cb95ce312baa20e0e7c.tar.gz
android_bionic-621b19dddbfba1cd98c01cb95ce312baa20e0e7c.tar.bz2
android_bionic-621b19dddbfba1cd98c01cb95ce312baa20e0e7c.zip
libc: enable FORTIFY_SOURCE snprintf under clang
Change-Id: I8b8059782a720104722b0841994b38f873ed02aa
Diffstat (limited to 'tests/fortify2_test_clang.cpp')
-rw-r--r--tests/fortify2_test_clang.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/fortify2_test_clang.cpp b/tests/fortify2_test_clang.cpp
index 54a6e5a5a..7183bc0ce 100644
--- a/tests/fortify2_test_clang.cpp
+++ b/tests/fortify2_test_clang.cpp
@@ -174,6 +174,15 @@ TEST(Fortify2_Clang_DeathTest, strncpy_fortified) {
ASSERT_EXIT(strncpy(bufb, bufa, n), testing::KilledBySignal(SIGABRT), "");
}
+TEST(Fortify2_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), "");
+}
+
__BIONIC_FORTIFY_INLINE
size_t test_fortify2_inline(char* buf) {
return __bos(buf);