From: Volker Lendecke Date: Tue, 29 Jul 2025 12:49:33 +0000 (+0200) Subject: vfs_streams_xattr: Add some overflow protection to pread and pwrite X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26fab22383e5d01fc51ab04f80bcea4c9bcf2cc4;p=thirdparty%2Fsamba.git vfs_streams_xattr: Add some overflow protection to pread and pwrite Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index da20997a6a5..93044924b34 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -1010,6 +1010,11 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); } + if ((offset < 0) || ((offset + n) < n)) { + errno = EOVERFLOW; + return -1; + } + if (!streams_xattr_recheck(sio)) { return -1; } @@ -1092,6 +1097,11 @@ static ssize_t streams_xattr_pread(vfs_handle_struct *handle, return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); } + if ((offset < 0) || ((offset + n) < n)) { + errno = EOVERFLOW; + return -1; + } + if (!streams_xattr_recheck(sio)) { return -1; }