Skip to content

Commit ed2a8db

Browse files
committed
Add files via upload
1 parent 9c3b7e8 commit ed2a8db

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.c:8:6:8:51 | ... & ... | this bit expression needs your attention |
2+
| test.c:10:6:10:30 | ... & ... | this bit expression needs your attention |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
experimental/Security/CWE/CWE-691/InsufficientControlFlowManagementWhenUsingBitOperations.ql
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
int tmpFunction(){
2+
return 5;
3+
}
4+
void workFunction_0(char *s) {
5+
int intSize;
6+
char buf[80];
7+
if(intSize>0 && intSize<80 && memset(buf,0,intSize)) return; // GOOD
8+
if(intSize>0 & intSize<80 & memset(buf,0,intSize)) return; // BAD
9+
if(intSize>0 && tmpFunction()) return;
10+
if(intSize<0 & tmpFunction()) return; // BAD
11+
}
12+
void workFunction_1(char *s) {
13+
int intA,intB;
14+
15+
if(intA + intB) return; // BAD
16+
if(intA + intB>4) return; // GOOD
17+
if(intA>0 && (intA + intB)) return; // BAD
18+
while(intA>0)
19+
{
20+
if(intB - intA<10) break;
21+
intA--;
22+
}while(intA>0); // BAD
23+
while(intA>0)
24+
{
25+
if(intB - intA<10) break;
26+
intA--;
27+
} // GOOD
28+
}

0 commit comments

Comments
 (0)