Skip to content

Commit 148b497

Browse files
committed
check 'i' limit before using it as an array index.
fix cppcheck "Array index 'i' is used before limits check."
1 parent 3581ebb commit 148b497

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/unity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ void UnityAssertEqualStringLen(const char* expected,
10041004
/* if both pointers not null compare the strings */
10051005
if (expected && actual)
10061006
{
1007-
for (i = 0; (expected[i] || actual[i]) && i < length; i++)
1007+
for (i = 0; (i < length) && (expected[i] || actual[i]); i++)
10081008
{
10091009
if (expected[i] != actual[i])
10101010
{

0 commit comments

Comments
 (0)