Alexandre Julliard : kernel32: Store the symlink target directly into the correct buffer in GetVolumeNameForVolumeMountPointW .

Alexandre Julliard julliard at winehq.org
Thu Oct 22 10:39:57 CDT 2009


Module: wine
Branch: master
Commit: 985dd537126f13d4fd91be0d985b4bc308e7bf20
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=985dd537126f13d4fd91be0d985b4bc308e7bf20

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Oct 22 14:57:24 2009 +0200

kernel32: Store the symlink target directly into the correct buffer in GetVolumeNameForVolumeMountPointW.

---

 dlls/kernel32/volume.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 9fcd061..4a51d50 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -797,7 +797,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR
     WCHAR *p;
     char *r;
     DWORD i, i_size = 1024, o_size = 1024;
-    WCHAR nonpersist_name[200];
+    WCHAR *nonpersist_name;
     WCHAR symlink_name[MAX_PATH];
     NTSTATUS status;
     HANDLE mgr = INVALID_HANDLE_VALUE;
@@ -846,8 +846,8 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR
 
     /* Take the mount point and get the "nonpersistent name" */
     /* We will then take that and get the volume name        */
-    status = read_nt_symlink( symlink_name, nonpersist_name,
-                                sizeof(nonpersist_name)/sizeof(WCHAR) );
+    nonpersist_name = (WCHAR *)(input + 1);
+    status = read_nt_symlink( symlink_name, nonpersist_name, i_size - sizeof(*input) );
     TRACE("read_nt_symlink got stat=%x, for %s, got <%s>\n", status,
             debugstr_w(symlink_name), debugstr_w(nonpersist_name));
     if (status != STATUS_SUCCESS)
@@ -862,7 +862,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR
     memset( input, 0, sizeof(*input) );  /* clear all input parameters */
     input->DeviceNameOffset = sizeof(*input);
     input->DeviceNameLength = lstrlenW( nonpersist_name) * sizeof(WCHAR);
-    memcpy( input + 1, nonpersist_name, input->DeviceNameLength );
+    i_size = input->DeviceNameOffset + input->DeviceNameLength;
 
     output->Size = o_size;
 




More information about the wine-cvs mailing list