check 'i' limit before using it as an array index.

fix cppcheck "Array index 'i' is used before limits check."
上级 3581ebb6
......@@ -1004,7 +1004,7 @@ void UnityAssertEqualStringLen(const char* expected,
/* if both pointers not null compare the strings */
if (expected && actual)
{
for (i = 0; (expected[i] || actual[i]) && i < length; i++)
for (i = 0; (i < length) && (expected[i] || actual[i]); i++)
{
if (expected[i] != actual[i])
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册