@@ -19,7 +19,30 @@ import semmle.code.cpp.ir.dataflow.TaintTracking
19
19
import DataFlow:: PathGraph
20
20
21
21
/**
22
- * A taint flow configuration for flow from user input to a buffer write.
22
+ * A buffer write into a sensitive expression.
23
+ */
24
+ class SensitiveBufferWrite extends Expr {
25
+ BufferWrite:: BufferWrite write ;
26
+
27
+ SensitiveBufferWrite ( ) {
28
+ this = write and
29
+ write .getDest ( ) instanceof SensitiveExpr
30
+ }
31
+
32
+ /**
33
+ * Gets a data source of this operation.
34
+ */
35
+ Expr getASource ( ) { result = write .getASource ( ) }
36
+
37
+ /**
38
+ * Gets the destination buffer of this operation.
39
+ */
40
+ Expr getDest ( ) { result = write .getDest ( ) }
41
+ }
42
+
43
+ /**
44
+ * A taint flow configuration for flow from user input to a buffer write
45
+ * into a sensitive expression.
23
46
*/
24
47
class ToBufferConfiguration extends TaintTracking:: Configuration {
25
48
ToBufferConfiguration ( ) { this = "ToBufferConfiguration" }
@@ -31,12 +54,12 @@ class ToBufferConfiguration extends TaintTracking::Configuration {
31
54
}
32
55
33
56
override predicate isSink ( DataFlow:: Node sink ) {
34
- exists ( BufferWrite :: BufferWrite w | w .getASource ( ) = sink .asExpr ( ) )
57
+ exists ( SensitiveBufferWrite w | w .getASource ( ) = sink .asExpr ( ) )
35
58
}
36
59
}
37
60
38
61
from
39
- ToBufferConfiguration config , BufferWrite :: BufferWrite w , DataFlow:: PathNode sourceNode ,
62
+ ToBufferConfiguration config , SensitiveBufferWrite w , DataFlow:: PathNode sourceNode ,
40
63
DataFlow:: PathNode sinkNode , FlowSource source , SensitiveExpr dest
41
64
where
42
65
config .hasFlowPath ( sourceNode , sinkNode ) and
0 commit comments