Skip to content

Commit b5bcbd3

Browse files
committed
C++: Cleaner solution.
1 parent 81205f3 commit b5bcbd3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cpp/ql/src/Security/CWE/CWE-089/SqlTainted.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ class Configuration extends TaintTrackingConfiguration {
2828
exists(SQLLikeFunction runSql | runSql.outermostWrapperFunctionCall(tainted, _))
2929
}
3030

31-
override predicate isAdditionalBarrier(Expr e) { e.getUnspecifiedType() instanceof IntegralType }
31+
override predicate isBarrier(Expr e) {
32+
super.isBarrier(e) or e.getUnspecifiedType() instanceof IntegralType
33+
}
3234
}
3335

3436
from

cpp/ql/src/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,8 @@ module TaintedWithPath {
545545
/** Override this to specify which elements are sinks in this configuration. */
546546
abstract predicate isSink(Element e);
547547

548-
/** Override this to specify additional barriers in this configuration. */
549-
predicate isAdditionalBarrier(Expr node) { none() }
548+
/** Override this to specify which expressions are barriers in this configuration. */
549+
predicate isBarrier(Expr e) { nodeIsBarrier(getNodeForExpr(e)) }
550550

551551
/**
552552
* Override this predicate to `any()` to allow taint to flow through global
@@ -582,10 +582,8 @@ module TaintedWithPath {
582582
}
583583

584584
override predicate isBarrier(DataFlow::Node node) {
585-
nodeIsBarrier(node)
586-
or
587585
exists(TaintTrackingConfiguration cfg, Expr e |
588-
cfg.isAdditionalBarrier(e) and node = getNodeForExpr(e)
586+
cfg.isBarrier(e) and node = getNodeForExpr(e)
589587
)
590588
}
591589

0 commit comments

Comments
 (0)