HomeFreeBSD

hastd: Fix nv data size check

Description

hastd: Fix nv data size check

The data size check, as currently written, can be defeated by providing
a very large number that rounds up to 0, which will pass the check
(because zero plus the size of the header and name is smaller than the
size of the message) but cause a segfault later when used to index the
data array.

Rewrite the data size check to take rounding into account, and add a
cast to ensure the name size can't round up to zero.

MFC after: 1 week
PR: 266827
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D51615

Details

Provenance
desAuthored on Aug 6 2025, 1:49 PM
Reviewer
markj
Differential Revision
D51615: hastd: Fix nv data size check
Parents
rG3456a0de9465: ObsoleteFiles: Stop looking for catpages
Branches
Unknown
Tags
Unknown