summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-08 03:06:10 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-08 03:06:10 +0000
commit49cbfc8359801c5adf22d00d31ab6a7882b9374a (patch)
treea839e0c04251c311f33b4272139f0ac4dde9b286 /win32/win32.c
parent161cee3c48a989466c9d6650555c1ff0177ae0f8 (diff)
* win32/win32.c (rb_w32_read_reparse_point): return correct required
buffer size for IO_REPARSE_TAG_MOUNT_POINT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 42ff582..d1cfb6b 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4777,7 +4777,7 @@ rb_w32_read_reparse_point(const WCHAR *path, rb_w32_reparse_buffer_t *rp,
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 *path, rb_w32_reparse_buffer_t *rp,
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;