Skip to content

Commit bb97507

Browse files
authored
Update test.c
1 parent 21f4325 commit bb97507

File tree

1 file changed

+17
-0
lines changed
  • cpp/ql/test/experimental/query-tests/Security/CWE/CWE-1126/semmle/tests

1 file changed

+17
-0
lines changed

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-1126/semmle/tests/test.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,27 @@ void workFunction_0(char *s) {
66
buf[intIndex] = 1;
77
intIndex--;
88
}
9+
intIndex = 10;
910
while(intIndex > 2)
1011
{
1112
buf[intIndex] = 1;
1213
int intIndex; // BAD
1314
intIndex--;
1415
}
16+
intIndex = 10;
17+
while(intIndex > 2) // GOOD
18+
{
19+
buf[intIndex] = 1;
20+
intIndex -= 2;
21+
int intIndex;
22+
intIndex--;
23+
}
24+
intIndex = 10;
25+
while(intIndex > 2) // GOOD
26+
{
27+
buf[intIndex] = 1;
28+
--intIndex;
29+
int intIndex;
30+
intIndex--;
31+
}
1532
}

0 commit comments

Comments
 (0)