diff options
author | Nick Kralevich <nnk@google.com> | 2013-06-24 11:44:00 -0700 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2013-06-24 14:10:29 -0700 |
commit | c6eb9854542c115fd9aa87731adcb1b5da57e8ac (patch) | |
tree | 5ca9c0df80389608790d1673951539774ff80195 /tests/fortify2_test_clang.cpp | |
parent | 53ddcc90701d86c7d809a84cf4710c651066e3c7 (diff) | |
download | android_bionic-c6eb9854542c115fd9aa87731adcb1b5da57e8ac.tar.gz android_bionic-c6eb9854542c115fd9aa87731adcb1b5da57e8ac.tar.bz2 android_bionic-c6eb9854542c115fd9aa87731adcb1b5da57e8ac.zip |
libc: enable sprintf FORTIFY_SOURCE under clang
clang doesn't support __builtin_va_arg_pack(), so we have
to use #define instead.
Change-Id: I2ee75e6267d60cdf997fee6b9b0547bf68f062a1
Diffstat (limited to 'tests/fortify2_test_clang.cpp')
-rw-r--r-- | tests/fortify2_test_clang.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/fortify2_test_clang.cpp b/tests/fortify2_test_clang.cpp index d8a0ba6d8..54a6e5a5a 100644 --- a/tests/fortify2_test_clang.cpp +++ b/tests/fortify2_test_clang.cpp @@ -109,6 +109,20 @@ TEST(Fortify2_Clang_DeathTest, strrchr_fortified) { } #endif +TEST(Fortify2_Clang_DeathTest, sprintf_fortified) { + ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + char buf[10]; + char source_buf[15]; + memcpy(source_buf, "12345678901234", 15); + ASSERT_EXIT(sprintf(buf, "%s", source_buf), testing::KilledBySignal(SIGABRT), ""); +} + +TEST(Fortify2_Clang_DeathTest, sprintf2_fortified) { + ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + char buf[5]; + ASSERT_EXIT(sprintf(buf, "aaaaa"), testing::KilledBySignal(SIGABRT), ""); +} + TEST(Fortify2_Clang_DeathTest, strncat_fortified) { ::testing::FLAGS_gtest_death_test_style = "threadsafe"; char buf[10]; |