mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Assert that the entropy source category provided by a caller submitting
entropy is valid, as an invalid source will cause dereferencing of an array of queues to an incorrect memory location.
This commit is contained in:
parent
a9befd40dd
commit
f5c3a74502
1 changed files with 6 additions and 0 deletions
|
|
@ -301,6 +301,12 @@ random_harvest_internal(u_int64_t somecounter, const void *entropy,
|
|||
{
|
||||
struct harvest *event;
|
||||
|
||||
KASSERT(origin == RANDOM_START || origin == RANDOM_WRITE ||
|
||||
origin == RANDOM_KEYBOARD || origin == RANDOM_MOUSE ||
|
||||
origin == RANDOM_NET || origin == RANDOM_INTERRUPT ||
|
||||
origin == RANDOM_PURE || origin == ENTROPYSOURCE,
|
||||
("random_harvest_internal: origin %d invalid\n", origin));
|
||||
|
||||
/* Lockless read to avoid lock operations if fifo is full. */
|
||||
if (harvestfifo[origin].count >= RANDOM_FIFO_MAX)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue