Improve execve() path argument munging

Munging of paths passed inside the system() interpreter command is no
longer supported. You have to pass your paths to posix_spawn() or the
execve() family of functions if you want them to be munged. The first
three characters must match `^/[a-z]/` in which case, it'll be turned
into a DOS-style drive path with backslashes.
This commit is contained in:
Justine Tunney 2023-11-17 09:54:11 -08:00
parent 529cb4817c
commit 32b97f2d25
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
5 changed files with 88 additions and 78 deletions

View file

@ -74,30 +74,14 @@ TEST(mkntcmdline, testUnicode) {
cmdline);
}
TEST(mkntcmdline, fixAsBestAsWeCanForNow1) {
TEST(mkntcmdline, fixit) {
char *argv1[] = {
"/C/WINDOWS/system32/cmd.exe",
"/C",
"more <\"/C/Users/jart/AppData/Local/Temp/tmplquaa_d6\"",
"/C/Program Files/doom/doom.exe",
"--version",
NULL,
};
EXPECT_NE(-1, mkntcmdline(cmdline, argv1));
EXPECT_STREQ(u"C:\\WINDOWS\\system32\\cmd.exe /C \"more <"
u"\"\"\"C:/Users/jart/AppData/Local/Temp/tmplquaa_d6\"\"\"\"",
cmdline);
}
TEST(mkntcmdline, fixAsBestAsWeCanForNow2) {
char *argv1[] = {
"/C/WINDOWS/system32/cmd.exe",
"/C",
"less /C/Users/jart/AppData/Local/Temp/tmplquaa_d6",
NULL,
};
EXPECT_NE(-1, mkntcmdline(cmdline, argv1));
EXPECT_STREQ(u"C:\\WINDOWS\\system32\\cmd.exe /C \"less "
u"C:/Users/jart/AppData/Local/Temp/tmplquaa_d6\"",
cmdline);
EXPECT_STREQ(u"\"C:\\Program Files\\doom\\doom.exe\" --version", cmdline);
}
TEST(mkntcmdline, testWut) {