Skip to content

Commit 8735d48

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Prevent scp-style arguments from being mangled
An argument like [email protected]:/tmp/ is not something we should convert into a Windows path; Use the absence of a slash before the colon as a tell-tale that it is *not* a POSIX path list (exception: if the part left of the colon is "." or ".."). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 399fd28 commit 8735d48

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

winsup/cygwin/msys2_path_conv.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
455455

456456
int starts_with_minus = 0;
457457
int starts_with_minus_alpha = 0;
458+
int only_dots = *it == '.';
459+
int has_slashes = 0;
458460
if (*it == '-') {
459461
starts_with_minus = 1;
460462
it += 1;
@@ -498,11 +500,17 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
498500
if (ch == '/' && *(it2 + 1) == '/') {
499501
return URL;
500502
} else {
503+
if (!only_dots && !has_slashes)
504+
goto skip_p2w;
501505
return POSIX_PATH_LIST;
502506
}
503507
} else if (memchr(it2, '=', end - it) == NULL) {
504508
return SIMPLE_WINDOWS_PATH;
505509
}
510+
} else if (ch != '.') {
511+
only_dots = 0;
512+
if (ch == '/' || ch == '\\')
513+
has_slashes = 1;
506514
}
507515
}
508516

0 commit comments

Comments
 (0)