Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that
rngfill
returns the requested amount of randomness:
One of the two versions of the `rngfill` function accepts a pointer to a buffer and a size (in bytes). The function aims to fill the provided `buffer` with `size` random bytes. It does this in chunks of 8 bytes, for long as possible, and then fills any left-over gap one byte at a time. To avoid an annoying and incorrect warning about a potential buffer overflow in the "trailing write", commit 78bc272 used a `#pragma` to instruct the compiler to not generate the incorrect diagnostic. Unfortunately, this change _also_ eliminated the trailing write code, which means that, under some cases, the `rngfill` function would generate between 1 and 7 fewer random bytes than requested. This problem would only manifest on builds that do not define `__GNUC__` which, as of this writing, means MSVC.
- Loading branch information