Page MenuHomeFreeBSD

libnv: Fix a length check in nvpair_unpack_string_array()
ClosedPublic

Authored by markj on Oct 13 2025, 1:44 PM.
Tags
None
Referenced Files
F138970982: D53069.diff
Sat, Dec 6, 2:35 AM
Unknown Object (File)
Wed, Nov 26, 3:28 AM
Unknown Object (File)
Tue, Nov 25, 10:56 AM
Unknown Object (File)
Sat, Nov 22, 10:53 AM
Unknown Object (File)
Mon, Nov 10, 7:16 AM
Unknown Object (File)
Fri, Nov 7, 9:40 PM
Unknown Object (File)
Fri, Nov 7, 6:27 PM
Unknown Object (File)
Nov 1 2025, 6:03 AM
Subscribers

Details

Summary

A string array is represented by a set of nul-terminated strings
concatenated together. For each string, we check to see if there's a
nul terminator at the end, taking care to avoid going past the end of
the buffer. However, the code fails to handle the possibility that
size == 0 at the end of an iteration, leading to underflow.

Fix the length check.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable