Skip to content

Commit 61ce725

Browse files
committed
C++: Update the alert message in 'cpp/iterator-to-expired-container'.
1 parent b86aeb6 commit 61ce725

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

cpp/ql/src/Security/CWE/CWE-416/IteratorToExpiredContainer.ql

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ DataFlow::Node getADestroyedNode(DataFlow::Node n) {
6262
)
6363
}
6464

65-
predicate destroyedToBeginSink(DataFlow::Node sink, FunctionCall fc) {
65+
predicate destroyedToBeginSink(DataFlow::Node sink) {
6666
exists(CallInstruction call |
6767
call = sink.asOperand().(ThisArgumentOperand).getCall() and
68-
fc = call.getUnconvertedResultExpression() and
6968
call.getStaticCallTarget() instanceof BeginOrEndFunction
7069
)
7170
}
@@ -90,7 +89,7 @@ private predicate qualifierToDestroyed(DataFlow::Node node1, DataFlow::Node node
9089
module Config0 implements DataFlow::ConfigSig {
9190
predicate isSource(DataFlow::Node source) { qualifierToDestroyed(_, source) }
9291

93-
predicate isSink(DataFlow::Node sink) { destroyedToBeginSink(sink, _) }
92+
predicate isSink(DataFlow::Node sink) { destroyedToBeginSink(sink) }
9493
}
9594

9695
module Flow0 = DataFlow::Global<Config0>;
@@ -150,9 +149,9 @@ module Config implements DataFlow::StateConfigSig {
150149

151150
module Flow = DataFlow::GlobalWithState<Config>;
152151

153-
from Flow::PathNode source, Flow::PathNode sink, FunctionCall beginOrEnd, DataFlow::Node mid
152+
from Flow::PathNode source, Flow::PathNode sink, DataFlow::Node mid
154153
where
155154
Flow::flowPath(source, sink) and
156-
destroyedToBeginSink(sink.getNode(), beginOrEnd) and
155+
destroyedToBeginSink(sink.getNode()) and
157156
sink.getState() = Config::DestroyedToBegin(mid)
158-
select mid, "This object is destroyed before $@ is called.", beginOrEnd, beginOrEnd.toString()
157+
select mid, "This object is destroyed at the end of the full-expression."

0 commit comments

Comments
 (0)