Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 427815d

Browse files
committed
C++: taintedWithPath QLDoc + simplification
1 parent 3653627 commit 427815d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,19 @@ module TaintedWithPath {
511511
key = "semmle.label" and val = n.toString()
512512
}
513513

514+
/**
515+
* Holds if `tainted` may contain taint from `source`, where `sourceNode` and
516+
* `sinkNode` are the corresponding `PathNode`s that can be used in a query
517+
* to provide path explanations. Extend `TaintTrackingConfiguration` to use
518+
* this predicate.
519+
*
520+
* A tainted expression is either directly user input, or is computed from
521+
* user input in a way that users can probably control the exact output of
522+
* the computation.
523+
*/
514524
predicate taintedWithPath(Expr source, Element tainted, PathNode sourceNode, PathNode sinkNode) {
515-
exists(AdjustedConfiguration cfg, DataFlow3::PathNode sinkInner, DataFlow::Node sink |
525+
exists(AdjustedConfiguration cfg, DataFlow3::PathNode sinkInner |
516526
sourceNode.(WrapPathNode).inner().getNode() = getNodeForSource(source) and
517-
sinkInner.getNode() = sink and
518527
cfg.hasFlowPath(sourceNode.(WrapPathNode).inner(), sinkInner) and
519528
tainted = adjustedSink(sinkInner.getNode()) and
520529
tainted = sinkNode.(FinalPathNode).inner()

0 commit comments

Comments
 (0)