lib/replace - add extra check to bsd_attr_list
authorAndrew Walker <awalker@ixsystems.com>
Tue, 27 Dec 2022 15:59:14 +0000 (10:59 -0500)
committerJule Anger <janger@samba.org>
Mon, 23 Jan 2023 10:59:28 +0000 (10:59 +0000)
commiteddd14cedbf6cc0a8c32f0e00e138c94aa941541
tree8050bc702d8491b28996b171f79d48275ee7fb97
parent1189604995793b1b5345ffad570688388f9248a8
lib/replace - add extra check to bsd_attr_list

The FreeBSD extattr API may return success and truncated
namelist. We need to check for this in bsd_attr_list to
ensure that we don't accidentally read off the end of the
buffer. In the case of a truncated value, the pascal
strings for attr names will reflect the lengths as if
the value were not truncated. For example:
`58DosStrea`

In case of short read we now set error to ERANGE and
fail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15271

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jan  2 14:27:23 UTC 2023 on sn-devel-184

(cherry picked from commit 01cdc5e00be78a51f0766634cc7fe50de2088203)

Autobuild-User(v4-16-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-16-test): Mon Jan 23 10:59:28 UTC 2023 on sn-devel-184
lib/replace/xattr.c