win,fs: match trailing slash presence in junctions to user input (#4590)
Refs: #4582
This commit is contained in:
parent
7e6590f31d
commit
058c49b7ba
16
src/win/fs.c
16
src/win/fs.c
@ -2566,15 +2566,17 @@ static void fs__create_junction(uv_fs_t* req, const WCHAR* path,
|
||||
|
||||
path_buf[path_buf_len++] = path[i];
|
||||
}
|
||||
if (add_slash)
|
||||
path_buf[path_buf_len++] = L'\\';
|
||||
len = path_buf_len - start;
|
||||
|
||||
/* Insert null terminator */
|
||||
path_buf[path_buf_len++] = L'\0';
|
||||
|
||||
/* Set the info about the substitute name */
|
||||
buffer->MountPointReparseBuffer.SubstituteNameOffset = start * sizeof(WCHAR);
|
||||
buffer->MountPointReparseBuffer.SubstituteNameLength = len * sizeof(WCHAR);
|
||||
|
||||
/* Insert null terminator */
|
||||
path_buf[path_buf_len++] = L'\0';
|
||||
|
||||
/* Copy the print name of the target path */
|
||||
start = path_buf_len;
|
||||
add_slash = 0;
|
||||
@ -2592,18 +2594,18 @@ static void fs__create_junction(uv_fs_t* req, const WCHAR* path,
|
||||
path_buf[path_buf_len++] = path[i];
|
||||
}
|
||||
len = path_buf_len - start;
|
||||
if (len == 2) {
|
||||
if (len == 2 || add_slash) {
|
||||
path_buf[path_buf_len++] = L'\\';
|
||||
len++;
|
||||
}
|
||||
|
||||
/* Insert another null terminator */
|
||||
path_buf[path_buf_len++] = L'\0';
|
||||
|
||||
/* Set the info about the print name */
|
||||
buffer->MountPointReparseBuffer.PrintNameOffset = start * sizeof(WCHAR);
|
||||
buffer->MountPointReparseBuffer.PrintNameLength = len * sizeof(WCHAR);
|
||||
|
||||
/* Insert another null terminator */
|
||||
path_buf[path_buf_len++] = L'\0';
|
||||
|
||||
/* Calculate how much buffer space was actually used */
|
||||
used_buf_size = FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) +
|
||||
path_buf_len * sizeof(WCHAR);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user