File tree Expand file tree Collapse file tree
cpp/ql/test/experimental/query-tests/Security/CWE/CWE-1126/semmle/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11void 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 ;
You can’t perform that action at this time.
0 commit comments