[PATCH] ntdll: Initialize mountmgr_unix_drive before NtDeviceIoControlFile (valgrind).

Rémi Bernon rbernon at codeweavers.com
Mon Mar 8 02:14:20 CST 2021


  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>
---

It would maybe be better to have a separate struct for the ioct input,
but this is how it's done elsewhere instead.

 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 bcaf03a2d02..65042f189af 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;
-- 
2.30.0




More information about the wine-devel mailing list