Skip to content

Commit 9def3dd

Browse files
MathiasVPgeoffw0
andauthored
Update swift/ql/src/queries/Security/CWE-321/HardcodedEncryptionKey.swift
Co-authored-by: Geoffrey White <[email protected]>
1 parent 03ef18b commit 9def3dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

swift/ql/src/queries/Security/CWE-321/HardcodedEncryptionKey.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func encrypt(padding : Padding) {
1414

1515
// GOOD: Using randomly generated keys for encryption
1616
var key = [Int8](repeating: 0, count: 10)
17-
let status = SecRandomCopyBytes(kSecRandomDefault, key.count, &key)
17+
let status = SecRandomCopyBytes(kSecRandomDefault, key.count - 1, &key)
1818
if status == errSecSuccess {
1919
let keyString = String(cString: key)
2020
let ivString = getRandomIV()

0 commit comments

Comments
 (0)