Merge pull request #457 from owen-mc/cleanup-avoid-code-duplication

Reuse existing class instead of repeating it
This commit is contained in:
Owen Mansel-Chan
2021-01-21 10:56:14 +00:00
committed by GitHub

View File

@@ -4,6 +4,7 @@
*/
import go
import semmle.go.dataflow.BarrierGuardUtil
/**
* Provides extension points for customizing the taint tracking configuration for reasoning about
@@ -133,18 +134,5 @@ module TaintedPath {
*
* This is overapproximate: we do not attempt to reason about the correctness of the regexp.
*/
class RegexpCheck extends SanitizerGuard {
RegexpMatchFunction matchfn;
DataFlow::CallNode call;
RegexpCheck() {
matchfn.getACall() = call and
this = matchfn.getResult().getNode(call).getASuccessor*()
}
override predicate checks(Expr e, boolean branch) {
e = matchfn.getValue().getNode(call).asExpr() and
(branch = false or branch = true)
}
}
class RegexpCheckAsSanitizerGuard extends RegexpCheck, SanitizerGuard { }
}