File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
cpp/ql/test/experimental/query-tests/Security/CWE/CWE-1126/semmle/tests Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1
1
void workFunction_0 (char * s ) {
2
2
int intIndex = 10 ;
3
+ int intGuard ;
3
4
char buf [80 ];
4
5
while (intIndex > 2 ) // GOOD
5
6
{
@@ -14,6 +15,32 @@ void workFunction_0(char *s) {
14
15
intIndex -- ;
15
16
}
16
17
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 ;
17
44
while (intIndex > 2 ) // GOOD
18
45
{
19
46
buf [intIndex ] = 1 ;
You can’t perform that action at this time.
0 commit comments