Skip to content

Commit 157a782

Browse files
committed
Swift: correct the example.
1 parent ad05cc3 commit 157a782

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

swift/ql/src/queries/Security/CWE-134/UncontrolledFormatString.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Passing untrusted format strings to functions that use <code>printf</code> style
1313
<p>Use a string literal for the format string to prevent the possibility of data flow from
1414
an untrusted source. This also helps to prevent errors where the format arguments do not match the format string.</p>
1515

16-
<p>If the format string cannot be constant, ensure that it comes from a secure data source or is compiled into the source code. If you need to include a value from the user, use the <code>%s</code> specifier in the format string and include that value as a format argument.
16+
<p>If the format string cannot be constant, ensure that it comes from a secure data source or is compiled into the source code. If you need to include a value from the user, use the <code>%@</code> specifier in the format string and include that value as a format argument.
1717
</p>
1818

1919
</recommendation>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
print(String(format: "User input: %s", inputString)) // fixed
2+
print(String(format: "User input: %@", inputString)) // fixed

0 commit comments

Comments
 (0)