HomeFreeBSD

Fortuna: fix a correctness issue in reseed (fortuna_pre_read)

Description

Fortuna: fix a correctness issue in reseed (fortuna_pre_read)

'i' counts the number of pools included in the array 's'. Passing 'i+1' to
reseed_internal() as the number of blocks in 's' is a bogus overrun of the
initialized portion of 's' -- technically UB.

I found this via code inspection, referencing ยง9.5.2 "Pools" of the Fortuna
chapter, but I would expect Coverity to notice the same issue.
Unfortunately, it doesn't appear to.

Reviewed by: markm
Approved by: secteam (gordon)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D16985
(cherry picked from commit 9a88479843e2314018f66fd2cdad5ae0200393d0)

Details

Provenance
cemAuthored on Oct 26 2018, 8:55 PM
obrienCommitted on Aug 6 2021, 5:12 AM
Reviewer
markm
Differential Revision
D16985: Fortuna: fix a correctness issue in reseed (fortuna_pre_read)
Parents
R10:ba2f52819c51: Fortuna: Fix a race to prevent reseed spamming
Branches
Unknown
Tags
Unknown