Skip to content

Commit 2999b5f

Browse files
committed
Swift: Mathias's fix for the non-constant format example.
1 parent 1084d7f commit 2999b5f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/codeql/codeql-language-guides/analyzing-data-flow-in-swift.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ The following example finds calls to ``String.init(format:_:)`` where the format
140140
import swift
141141
import codeql.swift.dataflow.DataFlow
142142
143-
from CallExpr call, Method method, Expr sinkExpr
143+
from CallExpr call, Method method, DataFlow::Node sinkNode
144144
where
145145
call.getStaticTarget() = method and
146146
method.hasQualifiedName("String", "init(format:_:)") and
147-
sinkExpr = call.getArgument(0).getExpr() and
147+
sinkNode.asExpr() = call.getArgument(0).getExpr() and
148148
not exists(StringLiteralExpr sourceLiteral |
149-
DataFlow::localFlow(DataFlow::exprNode(sourceLiteral), DataFlow::exprNode(sinkExpr))
149+
DataFlow::localFlow(DataFlow::exprNode(sourceLiteral), sinkNode)
150150
)
151151
select call, "Format argument to " + method.getName() + " isn't hard-coded."
152152

0 commit comments

Comments
 (0)