getxattr: trim the returned buffer to the correct size

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-11-08 16:19:54 +01:00
parent 7b6b494fff
commit d9339d016a

View File

@ -1880,6 +1880,7 @@ sub getxattr($$;$) {
if ($xattr_size < 0) {
return undef;
}
$buf = substr($buf, 0, $xattr_size);
return wantarray ? ($buf, $xattr_size) : $buf;
}