Skip to content

Commit 5c71a7c

Browse files
authored
Update test.c
1 parent 4083da3 commit 5c71a7c

File tree

1 file changed

+12
-7
lines changed
  • cpp/ql/test/experimental/query-tests/Security/CWE/CWE-561/semmle/tests

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
void testFunction(char c1)
1+
void testFunction(char c1,int i1)
22
{
33

4-
54
switch(c1){ // GOOD
65
case 12:
76
break;
@@ -10,7 +9,14 @@ void testFunction(char c1)
109
case 9:
1110
break;
1211
}
13-
12+
13+
switch(i1){ // GOOD
14+
for(i1=0;i1<20;i1++){
15+
case 12:
16+
case 10:
17+
case 9:
18+
}
19+
}
1420
switch(c1){ // BAD
1521
case 12:
1622
break;
@@ -20,7 +26,7 @@ void testFunction(char c1)
2026
break;
2127
dafault:
2228
}
23-
29+
2430
switch(c1){ // BAD
2531
c1=c1*2;
2632
case 12:
@@ -31,10 +37,9 @@ void testFunction(char c1)
3137
break;
3238
}
3339

34-
3540
if((c1<6)&&(c1>0))
3641
switch(c1){ // BAD
37-
case 7:
42+
case 8:
3843
break;
3944
case 5:
4045
break;
@@ -43,7 +48,7 @@ void testFunction(char c1)
4348
case 1:
4449
break;
4550
}
46-
51+
4752
if((c1<6)&&(c1>0))
4853
switch(c1){ // BAD
4954
case 3:

0 commit comments

Comments
 (0)