summaryrefslogtreecommitdiff
path: root/tests/fortify1_test_clang.cpp
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2013-06-20 12:34:11 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-06-20 12:34:11 -0700
commit33ae76abf32b8f78799e9ebb1de2343dfa10c91a (patch)
tree4845a4854b40fa5041c55b9df39257d6f26f11a2 /tests/fortify1_test_clang.cpp
parentcb4fd62762c23ba3b8d02a6f5329d2fd62b57db8 (diff)
parent5fed0eeabd88bfe241c416f2c2f44a14b6e447fa (diff)
am 5fed0eea: am 0ce28d20: Merge "libc: enable FORTIFY_SOURCE clang strlcpy"
* commit '5fed0eeabd88bfe241c416f2c2f44a14b6e447fa': libc: enable FORTIFY_SOURCE clang strlcpy
Diffstat (limited to 'tests/fortify1_test_clang.cpp')
-rw-r--r--tests/fortify1_test_clang.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/fortify1_test_clang.cpp b/tests/fortify1_test_clang.cpp
index 0c0fb2bef..fed9f13db 100644
--- a/tests/fortify1_test_clang.cpp
+++ b/tests/fortify1_test_clang.cpp
@@ -80,6 +80,16 @@ TEST(Fortify1_Clang_DeathTest, strrchr_fortified) {
memcpy(buf, "0123456789", sizeof(buf));
ASSERT_EXIT(printf("%s", strrchr(buf, 'a')), testing::KilledBySignal(SIGABRT), "");
}
+
+TEST(Fortify1_Clang_DeathTest, strlcpy_fortified) {
+ ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+ char bufa[15];
+ char bufb[10];
+ strcpy(bufa, "01234567890123");
+ size_t n = strlen(bufa);
+ ASSERT_EXIT(strlcpy(bufb, bufa, n), testing::KilledBySignal(SIGABRT), "");
+}
+
#endif
TEST(Fortify1_Clang_DeathTest, strncat_fortified) {