|
14 | 14 | import cpp |
15 | 15 | import semmle.code.cpp.security.SensitiveExprs |
16 | 16 | import semmle.code.cpp.dataflow.TaintTracking |
17 | | -import semmle.code.cpp.valuenumbering.GlobalValueNumbering |
18 | 17 | import semmle.code.cpp.models.interfaces.FlowSource |
19 | 18 | import semmle.code.cpp.commons.File |
20 | 19 | import DataFlow::PathGraph |
@@ -121,35 +120,30 @@ abstract class NetworkSendRecv extends FunctionCall { |
121 | 120 | NetworkSendRecv() { |
122 | 121 | this.getTarget() = target and |
123 | 122 | // exclude calls based on the socket... |
124 | | - not exists(GVN g | |
125 | | - g = globalValueNumber(target.getSocketExpr(this)) and |
| 123 | + not exists(DataFlow::Node src, DataFlow::Node dest | |
| 124 | + DataFlow::localFlow(src, dest) and |
| 125 | + dest.asExpr() = target.getSocketExpr(this) and |
126 | 126 | ( |
127 | 127 | // literal constant |
128 | | - globalValueNumber(any(Literal l)) = g |
| 128 | + src.asExpr() instanceof Literal |
129 | 129 | or |
130 | 130 | // variable (such as a global) initialized to a literal constant |
131 | 131 | exists(Variable v | |
132 | 132 | v.getInitializer().getExpr() instanceof Literal and |
133 | | - g = globalValueNumber(v.getAnAccess()) |
| 133 | + src.asExpr() = v.getAnAccess() |
134 | 134 | ) |
135 | 135 | or |
136 | 136 | // result of a function call with literal inputs (likely constant) |
137 | | - exists(FunctionCall fc | |
138 | | - forex(Expr arg | arg = fc.getAnArgument() | arg instanceof Literal) and |
139 | | - g = globalValueNumber(fc) |
140 | | - ) |
| 137 | + forex(Expr arg | arg = src.asExpr().(FunctionCall).getAnArgument() | arg instanceof Literal) |
141 | 138 | or |
142 | 139 | // variable called `stdin`, `stdout` or `stderr` |
143 | | - exists(VariableAccess v | |
144 | | - v.getTarget().getName() = ["stdin", "stdout", "stderr"] and |
145 | | - g = globalValueNumber(v) |
146 | | - ) |
| 140 | + src.asExpr().(VariableAccess).getTarget().getName() = ["stdin", "stdout", "stderr"] |
147 | 141 | or |
148 | 142 | // open of `"/dev/tty"` |
149 | 143 | exists(FunctionCall fc | |
150 | 144 | fopenCall(fc) and |
151 | 145 | fc.getAnArgument().getValue() = "/dev/tty" and |
152 | | - g = globalValueNumber(fc) |
| 146 | + src.asExpr() = fc |
153 | 147 | ) |
154 | 148 | // (this is not exhaustive) |
155 | 149 | ) |
|
0 commit comments