Skip to content

Commit

Permalink
step 10
Browse files Browse the repository at this point in the history
  • Loading branch information
ysf committed Mar 2, 2022
1 parent 58d2045 commit 28bee4a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions 10_taint_tracking.ql
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
/**
* @kind path-problem
*/

import cpp
import semmle.code.cpp.dataflow.TaintTracking
import DataFlow::PathGraph
class NetworkByteSwap extends Expr {
NetworkByteSwap () {
exists(MacroInvocation mi |
mi.getExpr() = this and
mi.getMacroName() in ["ntohll", "ntohs", "ntohl"]
)
}
}
class Config extends TaintTracking::Configuration {
Config() { this = "NetworkToMemFuncLength" }

override predicate isSource(DataFlow::Node source) {
source.asExpr() instanceof NetworkByteSwap
}
override predicate isSink(DataFlow::Node sink) {
exists(Function f |
f.hasName("memcpy")
)
}
}

from Config cfg, DataFlow::PathNode source, DataFlow::PathNode sink
where cfg.hasFlowPath(source, sink)
select sink, source, sink, "Network byte swap flows to memcpy"

1 comment on commit 28bee4a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 query changed between 58d2045 and 28bee4a after push to refs/heads/main:

  • 10_taint_tracking.ql

Results for 10_taint_tracking.ql: incorrect (4542 results):

Your query is selecting unexpected results
Expected query to produce 13 results

Unexpected results (first 10 only):

Please sign in to comment.