mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 18:15:18 -07:00
abort() if nacl_secure_random() ever returns 0 but the wrong size
This commit is contained in:
parent
40db481236
commit
681176e187
@ -15,10 +15,9 @@ randombytes_nativeclient_buf(void * const buf, const size_t size)
|
||||
{
|
||||
size_t readnb;
|
||||
|
||||
if (nacl_secure_random(buf, size, &readnb) != 0) {
|
||||
if (nacl_secure_random(buf, size, &readnb) != 0 || readnb != size) {
|
||||
abort();
|
||||
}
|
||||
assert(readnb == size);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
|
Loading…
Reference in New Issue
Block a user