Skip to content

Commit

Permalink
Convert bytes directly to Data instead of UnsafePointer API (#83)
Browse files Browse the repository at this point in the history
* Convert bytes directly to Data instead of UnsafePointer API

Using a pointer to an array created via the UnsafePointer initializer is
undefined and isn't guaranteed to be valid.

* Use non-deprecated initializer for Data
  • Loading branch information
jayrhynas authored Nov 14, 2024
1 parent 440f78d commit 4c9464b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/CryptorRSA/CryptorRSAUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public extension CryptorRSA {
index += 1

let strippedKeyBytes = [UInt8](byteArray[index...keyData.count - 1])
let data = Data(bytes: UnsafePointer<UInt8>(strippedKeyBytes), count: keyData.count - index)
let data = Data(strippedKeyBytes)
return data
}

Expand Down

0 comments on commit 4c9464b

Please sign in to comment.