aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-04-21 15:00:14 +0100
committerRon Yorston <rmy@pobox.com>2023-04-21 15:04:59 +0100
commit9ce85210e61e6c75adfc0ac0f54643cfee1353be (patch)
tree0954ee5130e8ba9a709d31405680c2b7b6d9d011
parent7b81a44c87cf71dfb4f647ba107624e208ffbefe (diff)
downloadbusybox-w32-9ce85210e61e6c75adfc0ac0f54643cfee1353be.tar.gz
busybox-w32-9ce85210e61e6c75adfc0ac0f54643cfee1353be.tar.bz2
busybox-w32-9ce85210e61e6c75adfc0ac0f54643cfee1353be.zip
su: escape quotes and backslashes in command
In 'su -c "CMD"' CMD should become a single argument to busybox sh -c ... But previously, the parameter string to ShellExecute was constructed by placing the literal value of CMD inside double quotes, which could result in incorrect and/or more than one parameter seen by the program, because double-quotes and (some) backslashes in CMD should be escaped while constructing the string, but they weren't. Now they're escaped so that the WIN32 CommandLineToArgv[W] parses it into a single argument with value identical to the original CMD.
-rw-r--r--loginutils/suw32.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/loginutils/suw32.c b/loginutils/suw32.c
index 3500c08db..df6d07232 100644
--- a/loginutils/suw32.c
+++ b/loginutils/suw32.c
@@ -61,7 +61,7 @@ int suw32_main(int argc UNUSED_PARAM, char **argv)
61 xasprintf("--busybox ash -d \"%s\" -t \"BusyBox ash (Admin)\" ", cwd); 61 xasprintf("--busybox ash -d \"%s\" -t \"BusyBox ash (Admin)\" ", cwd);
62 if (opt_command) 62 if (opt_command)
63 info.lpParameters = 63 info.lpParameters =
64 xasprintf("%s -s -c \"%s\"", info.lpParameters, opt_command); 64 xasprintf("%s -s -c %s", info.lpParameters, quote_arg(opt_command));
65 /* info.lpDirectory = NULL; */ 65 /* info.lpDirectory = NULL; */
66 info.nShow = SW_SHOWNORMAL; 66 info.nShow = SW_SHOWNORMAL;
67 67