mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
__swift_size_t on Windows is a size_t, which makes it potentially a 64-bit integer. ULONG, however, is always a 32-bit integer, and so this cast risks shrinking the apparent size of the cbBuffer argument to BCryptGenRandom. The effect of that will be to underfill the buffer, leaving it full of uninitialized memory that we would treat as random. The actual risk from this in the current implementation is basically zero, as user code can only ever invoke this with an argument size of 8. There's no good reason to leave this sharp edge on the API though.
3.6 KiB
3.6 KiB