[前][次][番号順一覧][スレッド一覧]

ruby-changes:39709

From: usa <ko1@a...>
Date: Tue, 8 Sep 2015 12:06:31 +0900 (JST)
Subject: [ruby-changes:39709] usa:r51790 (trunk): * win32/win32.c (rb_w32_read_reparse_point): return correct required

usa	2015-09-08 12:06:10 +0900 (Tue, 08 Sep 2015)

  New Revision: 51790

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51790

  Log:
    * win32/win32.c (rb_w32_read_reparse_point): return correct required
      buffer size for IO_REPARSE_TAG_MOUNT_POINT.

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51789)
+++ ChangeLog	(revision 51790)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Sep  8 12:05:00 2015  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (rb_w32_read_reparse_point): return correct required
+	  buffer size for IO_REPARSE_TAG_MOUNT_POINT.
+
 Tue Sep  8 00:14:43 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* process.c (rb_execarg_parent_start1): raise with the target path
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 51789)
+++ win32/win32.c	(revision 51790)
@@ -4777,7 +4777,7 @@ rb_w32_read_reparse_point(const WCHAR *p https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L4777
 			  size_t bufsize, WCHAR **result, DWORD *len)
 {
     int e = reparse_symlink(path, rp, bufsize);
-    DWORD ret;
+    DWORD ret = 0;
 
     if (!e || e == ERROR_MORE_DATA) {
 	void *name;
@@ -4785,17 +4785,18 @@ rb_w32_read_reparse_point(const WCHAR *p https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L4785
 	    name = ((char *)rp->SymbolicLinkReparseBuffer.PathBuffer +
 		    rp->SymbolicLinkReparseBuffer.PrintNameOffset);
 	    ret = rp->SymbolicLinkReparseBuffer.PrintNameLength;
+	    *len = ret / sizeof(WCHAR);
 	}
 	else { /* IO_REPARSE_TAG_MOUNT_POINT */
 	    /* +4/-4 means to drop "\??\" */
 	    name = ((char *)rp->MountPointReparseBuffer.PathBuffer +
 		    rp->MountPointReparseBuffer.SubstituteNameOffset +
 		    4 * sizeof(WCHAR));
-	    ret = rp->MountPointReparseBuffer.SubstituteNameLength -
-		  4 * sizeof(WCHAR);
+	    ret = rp->MountPointReparseBuffer.SubstituteNameLength;
+	    *len = ret / sizeof(WCHAR);
+	    ret -= 4 * sizeof(WCHAR);
 	}
 	*result = name;
-	*len = ret / sizeof(WCHAR);
 	if (e) {
 	    if ((char *)name + ret + sizeof(WCHAR) > (char *)rp + bufsize)
 		return e;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]