Skip to content

Commit 1e89952

Browse files
anodos325vlendec
authored andcommitted
CVE-2025-9640: s3/modules/vfs_streams_xattr fix unitialized write
This commit fixes a situation in which vfs_streams_xattr could write unitialized memory into alternate data streams if the user writes to an offset that is beyond the current end of file to insert a hole in it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15885 Signed-off-by: Andrew Walker <[email protected]> Reviewed-by: Volker Lendecke <[email protected]> Autobuild-User(master): Volker Lendecke <[email protected]> Autobuild-Date(master): Thu Oct 16 19:47:19 UTC 2025 on atb-devel-224
1 parent 59158cc commit 1e89952

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

source3/modules/vfs_streams_xattr.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,15 +1051,18 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
10511051

10521052
if ((offset + n) > ea.value.length-1) {
10531053
uint8_t *tmp;
1054+
size_t new_sz = offset + n + 1;
10541055

10551056
tmp = talloc_realloc(talloc_tos(), ea.value.data, uint8_t,
1056-
offset + n + 1);
1057+
new_sz);
10571058

10581059
if (tmp == NULL) {
10591060
TALLOC_FREE(ea.value.data);
10601061
errno = ENOMEM;
10611062
return -1;
10621063
}
1064+
1065+
memset(tmp + ea.value.length, 0, new_sz - ea.value.length);
10631066
ea.value.data = tmp;
10641067
ea.value.length = offset + n + 1;
10651068
ea.value.data[offset+n] = 0;

0 commit comments

Comments
 (0)