Merge "Disable %n in printf and vfwprintf."

This commit is contained in:
Elliott Hughes
2014-05-05 21:49:22 +00:00
committed by Gerrit Code Review
4 changed files with 20 additions and 6 deletions

View File

@@ -220,11 +220,16 @@ TEST(stdio, snprintf_ls) {
}
TEST(stdio, snprintf_n) {
#if !defined(__GLIBC__)
// http://b/14492135
char buf[32];
int i = 0;
EXPECT_EQ(4, snprintf(buf, sizeof(buf), "a %n b", &i));
EXPECT_EQ(2, i);
EXPECT_STREQ("a b", buf);
int i = 1234;
EXPECT_EQ(5, snprintf(buf, sizeof(buf), "a %n b", &i));
EXPECT_EQ(1234, i);
EXPECT_STREQ("a n b", buf);
#else
GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif
}
TEST(stdio, snprintf_smoke) {