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

Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
This commit is contained in:
Mathias Vorreiter Pedersen
2023-05-16 17:42:34 +01:00
committed by GitHub
parent 03ef18b286
commit 9def3dd440

View File

@@ -14,7 +14,7 @@ func encrypt(padding : Padding) {
// GOOD: Using randomly generated keys for encryption
var key = [Int8](repeating: 0, count: 10)
let status = SecRandomCopyBytes(kSecRandomDefault, key.count, &key)
let status = SecRandomCopyBytes(kSecRandomDefault, key.count - 1, &key)
if status == errSecSuccess {
let keyString = String(cString: key)
let ivString = getRandomIV()