File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed
test/query-tests/Security/CWE/CWE-807/semmle/TaintedCondition Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,10 @@ import semmle.code.cpp.ir.dataflow.TaintTracking
19
19
import semmle.code.cpp.ir.IR
20
20
import Flow:: PathGraph
21
21
22
- Expr getExprWithoutNot ( Expr expr ) {
23
- result = expr and not expr instanceof NotExpr
24
- or
25
- result = getExprWithoutNot ( expr .( NotExpr ) .getOperand ( ) ) and expr instanceof NotExpr
26
- }
27
-
28
22
predicate sensitiveCondition ( Expr condition , Expr raise ) {
29
23
raisesPrivilege ( raise ) and
30
24
exists ( IfStmt ifstmt |
31
- getExprWithoutNot ( ifstmt .getCondition ( ) ) = condition and
25
+ ifstmt .getCondition ( ) = condition and
32
26
raise .getEnclosingStmt ( ) .getParentStmt * ( ) = ifstmt
33
27
)
34
28
}
Original file line number Diff line number Diff line change 1
1
edges
2
- | test.cpp:20:29:20:47 | call to getenv | test.cpp:24:11 :24:16 | call to strcmp |
3
- | test.cpp:20:29:20:47 | call to getenv indirection | test.cpp:24:11 :24:16 | call to strcmp |
2
+ | test.cpp:20:29:20:47 | call to getenv | test.cpp:24:10 :24:35 | ! ... |
3
+ | test.cpp:20:29:20:47 | call to getenv indirection | test.cpp:24:10 :24:35 | ! ... |
4
4
nodes
5
5
| test.cpp:20:29:20:47 | call to getenv | semmle.label | call to getenv |
6
6
| test.cpp:20:29:20:47 | call to getenv indirection | semmle.label | call to getenv indirection |
7
- | test.cpp:24:11 :24:16 | call to strcmp | semmle.label | call to strcmp |
7
+ | test.cpp:24:10 :24:35 | ! ... | semmle.label | ! ... |
8
8
subpaths
9
9
#select
10
- | test.cpp:24:11 :24:16 | call to strcmp | test.cpp:20:29:20:47 | call to getenv | test.cpp:24:11 :24:16 | call to strcmp | Reliance on $@ to raise privilege at $@. | test.cpp:20:29:20:47 | call to getenv | an environment variable | test.cpp:25:9:25:27 | ... = ... | ... = ... |
11
- | test.cpp:24:11 :24:16 | call to strcmp | test.cpp:20:29:20:47 | call to getenv indirection | test.cpp:24:11 :24:16 | call to strcmp | Reliance on $@ to raise privilege at $@. | test.cpp:20:29:20:47 | call to getenv indirection | an environment variable | test.cpp:25:9:25:27 | ... = ... | ... = ... |
10
+ | test.cpp:24:10 :24:35 | ! ... | test.cpp:20:29:20:47 | call to getenv | test.cpp:24:10 :24:35 | ! ... | Reliance on $@ to raise privilege at $@. | test.cpp:20:29:20:47 | call to getenv | an environment variable | test.cpp:25:9:25:27 | ... = ... | ... = ... |
11
+ | test.cpp:24:10 :24:35 | ! ... | test.cpp:20:29:20:47 | call to getenv indirection | test.cpp:24:10 :24:35 | ! ... | Reliance on $@ to raise privilege at $@. | test.cpp:20:29:20:47 | call to getenv indirection | an environment variable | test.cpp:25:9:25:27 | ... = ... | ... = ... |
You can’t perform that action at this time.
0 commit comments