Disable %n in printf and vfwprintf.

Bug: 14492135
Change-Id: If190bede29e5f68a65043ddbe8e878c660933d03
This commit is contained in:
Elliott Hughes
2014-05-02 18:16:32 -07:00
parent e987803c35
commit e2341d08fa
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) {