mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Have execve() escape double quotes in cmd.exe's preferred style
This makes it possible for us to use system() and popen() with paths that redirect to filenames that contain spaces, e.g. system("echo.com hello >\"hello there.txt\"") It's difficult to solve this problem, because WIN32 only allows passing one single argument when launching programs and each program is allowed to tokenize that however it wants. Most software follows the convention of cmd.exe which is poorly documented and positively byzantine. In the future we're going to solve this by not using cmd.exe at all and instead embedding the cocmd.com interpreter into the system() function. In the meantime, our documentation has been updated to help recalibrate any expectation the user might hold regarding the security of using the Windows command interpreter. Fixes #644
This commit is contained in:
parent
acd8900071
commit
3f3cb0650b
15 changed files with 223 additions and 95 deletions
|
@ -47,11 +47,4 @@ TEST(mkntpath, testUnicode) {
|
|||
TEST(mkntpath, testRemoveDoubleSlash) {
|
||||
EXPECT_EQ(21, __mkntpath("C:\\Users\\jart\\\\.config", p));
|
||||
EXPECT_STREQ(u"C:\\Users\\jart\\.config", p);
|
||||
EXPECT_EQ(8, __mkntpath("\\\\?\\doge", p));
|
||||
EXPECT_STREQ(u"\\\\?\\doge", p);
|
||||
}
|
||||
|
||||
TEST(mkntpath, testJustC) {
|
||||
EXPECT_EQ(7, __mkntpath("/C", p));
|
||||
EXPECT_STREQ(u"\\\\?\\C:\\", p);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue