Skip to content

Commit

Permalink
zfs_send_notify_stream() would use byteoffset into wchar
Browse files Browse the repository at this point in the history
Signed-off-by: Jorgen Lundman <[email protected]>
  • Loading branch information
lundman committed Feb 29, 2024
1 parent fddfb6a commit 401d26b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions module/os/windows/zfs/zfs_vnops_windows_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2315,6 +2315,7 @@ zfs_send_notify_stream(zfsvfs_t *zfsvfs, char *name, int nameoffset,
zmo = zfsvfs->z_vfs;
UNICODE_STRING ustr;
UNICODE_STRING ustream;
int wideoffset = nameoffset * sizeof (WCHAR);

if (name == NULL)
return;
Expand All @@ -2324,8 +2325,11 @@ zfs_send_notify_stream(zfsvfs_t *zfsvfs, char *name, int nameoffset,

AsciiStringToUnicodeString(name, &ustr);

if (wideoffset > ustr.Length)
return;

dprintf("%s: '%wZ' part '%S' %lu %u\n", __func__, &ustr,
/* &name[nameoffset], */ &ustr.Buffer[nameoffset],
/* &name[nameoffset], */ &ustr.Buffer[wideoffset],
FilterMatch, Action);

if (stream != NULL) {
Expand All @@ -2336,7 +2340,7 @@ zfs_send_notify_stream(zfsvfs_t *zfsvfs, char *name, int nameoffset,
/* Is nameoffset in bytes, or in characters? */
FsRtlNotifyFilterReportChange(zmo->NotifySync, &zmo->DirNotifyList,
(PSTRING)&ustr,
nameoffset * sizeof (WCHAR),
wideoffset,
stream == NULL ? NULL : (PSTRING)&ustream, // StreamName
NULL, FilterMatch, Action, NULL, NULL);

Expand Down

0 comments on commit 401d26b

Please sign in to comment.