diff options
author | Uri Simchoni <uri@samba.org> | 2017-04-13 12:50:47 +0300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-04-18 00:43:20 +0200 |
commit | 4dfa2d6a0972847e3b21ddf05077e50ed72c4ea8 (patch) | |
tree | 673495e10e46716b4d792d5f4700fef1514a73bb /source3 | |
parent | 5017dfeef24b8d568e0146c085f3f979d688acf2 (diff) | |
download | samba-4dfa2d6a0972847e3b21ddf05077e50ed72c4ea8.tar.gz |
vfs_xattr_tdb: handle case of zero size.
With getxattr(), passing a zero buffer size is a
way of obtaining actual xattr size.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12737
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/vfs_xattr_tdb.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index b32fbc1e9eb..58acf446d2e 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -85,6 +85,12 @@ static ssize_t xattr_tdb_getxattr(struct vfs_handle_struct *handle, TALLOC_FREE(frame); return -1; } + + if (size == 0) { + TALLOC_FREE(frame); + return xattr_size; + } + if (blob.length > size) { TALLOC_FREE(frame); errno = ERANGE; @@ -125,6 +131,12 @@ static ssize_t xattr_tdb_fgetxattr(struct vfs_handle_struct *handle, TALLOC_FREE(frame); return -1; } + + if (size == 0) { + TALLOC_FREE(frame); + return xattr_size; + } + if (blob.length > size) { TALLOC_FREE(frame); errno = ERANGE; |