Skip to content

Commit d3c6093

Browse files
authored
Update test.c
1 parent c8f2937 commit d3c6093

File tree

1 file changed

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

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
void workFunction_0(char *s) {
22
int intIndex = 10;
3+
int intGuard;
34
char buf[80];
45
while(intIndex > 2) // GOOD
56
{
@@ -14,6 +15,32 @@ void workFunction_0(char *s) {
1415
intIndex--;
1516
}
1617
intIndex = 10;
18+
intGuard = 20;
19+
while(intIndex < intGuard--) // GOOD
20+
{
21+
buf[intIndex] = 1;
22+
int intIndex;
23+
intIndex--;
24+
}
25+
intIndex = 10;
26+
intGuard = 20;
27+
while(intIndex < intGuard) // GOOD
28+
{
29+
buf[intIndex] = 1;
30+
int intIndex;
31+
intIndex++;
32+
intGuard--;
33+
}
34+
intIndex = 10;
35+
intGuard = 20;
36+
while(intIndex < intGuard) // GOOD
37+
{
38+
buf[intIndex] = 1;
39+
int intIndex;
40+
intIndex--;
41+
intGuard -= 4;
42+
}
43+
intIndex = 10;
1744
while(intIndex > 2) // GOOD
1845
{
1946
buf[intIndex] = 1;

0 commit comments

Comments
 (0)