Rémi Bernon : ntdll: Initialize mountmgr_unix_drive before NtDeviceIoControlFile (valgrind).

Alexandre Julliard julliard at winehq.org
Tue Mar 9 14:55:19 CST 2021


Module: wine
Branch: master
Commit: 0eb3258a69fa168b2f9e0d44762261a150fc0ca9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0eb3258a69fa168b2f9e0d44762261a150fc0ca9

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Mar  8 09:14:20 2021 +0100

ntdll: Initialize mountmgr_unix_drive before NtDeviceIoControlFile (valgrind).

  Syscall param writev(vector[...]) points to uninitialised byte(s)
     at 0x4189DA3: writev (writev.c:26)
     by 0x46A5A1B: send_request (server.c:213)
     by 0x46A5A1B: server_call_unlocked (server.c:273)
     by 0x46CA54F: virtual_locked_server_call (virtual.c:2993)
     by 0x4681C9A: server_ioctl_file (file.c:4789)
     by 0x468B326: NtDeviceIoControlFile (file.c:5620)
     by 0x468B7AF: get_mountmgr_fs_info (file.c:1986)
     by 0x468B7AF: get_mountmgr_fs_info (file.c:1955)
     by 0x468FCBB: NtQueryVolumeInformationFile (file.c:6483)
     by 0x4677E88: __wine_syscall_dispatcher_xsave (in /home/rbernon/Code/build-wine/wine64/dlls/ntdll/ntdll.so)
     by 0x7BC0DEB3: NtQueryVolumeInformationFile (in /home/rbernon/Code/build-wine/wine64/dlls/ntdll/ntdll.dll)
     by 0x7B01F127: GetFileInformationByHandle (file.c:2938)
     by 0x7096A5C3: _fstat64 (file.c:1791)
     by 0x7096A941: _fstat64i32 (file.c:1877)
   Address 0x7ffffe30e520 is in a rw- anonymous segment

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index c169b49343f..233778df3b2 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1963,13 +1963,13 @@ static NTSTATUS get_mountmgr_fs_info( HANDLE handle, int fd, struct mountmgr_uni
     letter = find_dos_device( unix_name );
     free( unix_name );
 
+    memset( drive, 0, sizeof(*drive) );
     if (letter == -1)
     {
         struct stat st;
 
         fstat( fd, &st );
         drive->unix_dev = st.st_rdev ? st.st_rdev : st.st_dev;
-        drive->letter = 0;
     }
     else
         drive->letter = 'a' + letter;




More information about the wine-cvs mailing list