Skip to content

Commit 2681617

Browse files
committed
C++: Undo the workaround in 'cpp/tainted-permissions-check'.
1 parent 0c924c2 commit 2681617

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

cpp/ql/src/Security/CWE/CWE-807/TaintedCondition.ql

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@ import semmle.code.cpp.ir.dataflow.TaintTracking
1919
import semmle.code.cpp.ir.IR
2020
import Flow::PathGraph
2121

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-
2822
predicate sensitiveCondition(Expr condition, Expr raise) {
2923
raisesPrivilege(raise) and
3024
exists(IfStmt ifstmt |
31-
getExprWithoutNot(ifstmt.getCondition()) = condition and
25+
ifstmt.getCondition() = condition and
3226
raise.getEnclosingStmt().getParentStmt*() = ifstmt
3327
)
3428
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
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 | ! ... |
44
nodes
55
| test.cpp:20:29:20:47 | call to getenv | semmle.label | call to getenv |
66
| 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 | ! ... |
88
subpaths
99
#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 | ... = ... | ... = ... |

0 commit comments

Comments
 (0)