From 148b4977cf25238d1458b165e649d0ca780a1305 Mon Sep 17 00:00:00 2001 From: Jeremy Hannon Date: Mon, 26 Sep 2016 16:01:03 -0500 Subject: [PATCH] check 'i' limit before using it as an array index. fix cppcheck "Array index 'i' is used before limits check." --- src/unity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unity.c b/src/unity.c index 58e93db..a43e33e 100644 --- a/src/unity.c +++ b/src/unity.c @@ -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]) { -- GitLab