HomeFreeBSD

libnv: Fix a length check in nvpair_unpack_string_array()

Description

libnv: Fix a length check in nvpair_unpack_string_array()

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>
Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D53069

(cherry picked from commit 937693fc9e4ff4045cc674a14902f0d53e84ec98)

Details

Provenance
markjAuthored on Wed, Oct 15, 8:15 PM
Reviewer
emaste
Differential Revision
D53069: libnv: Fix a length check in nvpair_unpack_string_array()
Parents
rG302c4c540e44: ipfw: Check for errors from sooptcopyin() and sooptcopyout()
Branches
Unknown
Tags
Unknown