提交 645b2a70 编写于 作者: C chuaizhzh

修改Sscanf用例crash的问题

Change-Id: I3ad8064485ced9689f1d13feb27d63d6d96af9cc
上级 0c41409b
......@@ -151,9 +151,10 @@ HWTEST_F(IoTest, testSscanfChar, Function | MediumTest | Level1)
EXPECT_EQ(ret, 1) << "> sscanf fail, errno = " << errno;
EXPECT_EQ(c, 'a');
ret = sscanf("hello", "%5c", &c);
char c2[10] = {0};
ret = sscanf("helloworld", "%5c", c2);
EXPECT_EQ(ret, 1) << "> sscanf fail, errno = " << errno;
EXPECT_EQ(c, 'h');
EXPECT_EQ(c2, "hello");
ret = sscanf("(a) and |b|", "(%c) and |%c%*c|", &c, &c1);
EXPECT_EQ(ret, 2) << "> sscanf fail, errno = " << errno;
......@@ -617,4 +618,4 @@ HWTEST_F(IoTest, testSscanfReturnValue, Function | MediumTest | Level1)
EXPECT_EQ(ip[1], 11);
EXPECT_EQ(ip[2], 11);
EXPECT_EQ(ip[3], 0);
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册