mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
23 lines
730 B
Plaintext
23 lines
730 B
Plaintext
import cpp
|
|
import semmle.code.cpp.dataflow.new.DataFlow
|
|
|
|
module LiteralToGethostbynameConfig implements DataFlow::ConfigSig {
|
|
predicate isSource(DataFlow::Node source) { source.asIndirectExpr(1) instanceof StringLiteral }
|
|
|
|
predicate isSink(DataFlow::Node sink) {
|
|
exists(FunctionCall fc |
|
|
sink.asIndirectExpr(1) = fc.getArgument(0) and
|
|
fc.getTarget().hasName("gethostbyname")
|
|
)
|
|
}
|
|
}
|
|
|
|
module LiteralToGethostbynameFlow = DataFlow::Global<LiteralToGethostbynameConfig>;
|
|
|
|
from StringLiteral sl, FunctionCall fc, DataFlow::Node source, DataFlow::Node sink
|
|
where
|
|
source.asIndirectExpr(1) = sl and
|
|
sink.asIndirectExpr(1) = fc.getArgument(0) and
|
|
LiteralToGethostbynameFlow::flow(source, sink)
|
|
select sl, fc
|