diff options
author | Joe Simmons-Talbott <josimmon@redhat.com> | 2023-03-22 14:04:30 -0400 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-03-28 10:12:30 -0300 |
commit | 868506eb427c9dcc6d869cd4885679be04e1b7dd (patch) | |
tree | 11233f242405423c14ff09fe781131696d4c73b0 /sysdeps/posix | |
parent | 31bfe3ef4ea898df606cb6cc59ac72de27002b01 (diff) | |
download | glibc-868506eb427c9dcc6d869cd4885679be04e1b7dd.tar glibc-868506eb427c9dcc6d869cd4885679be04e1b7dd.tar.gz glibc-868506eb427c9dcc6d869cd4885679be04e1b7dd.tar.bz2 glibc-868506eb427c9dcc6d869cd4885679be04e1b7dd.zip |
system: Add "--" after "-c" for sh (BZ #28519)
Prevent sh from interpreting a user string as shell options if it
starts with '-' or '+'. Since the version of /bin/sh used for testing
system() is different from the full-fledged system /bin/sh add support
to it for handling "--" after "-c". Add a testcase to ensure the
expected behavior.
Signed-off-by: Joe Simmons-Talbott <josimmon@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/posix')
-rw-r--r-- | sysdeps/posix/system.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c index d77720a625..488b95163b 100644 --- a/sysdeps/posix/system.c +++ b/sysdeps/posix/system.c @@ -147,6 +147,7 @@ do_system (const char *line) ret = __posix_spawn (&pid, SHELL_PATH, 0, &spawn_attr, (char *const[]){ (char *) SHELL_NAME, (char *) "-c", + (char *) "--", (char *) line, NULL }, __environ); __posix_spawnattr_destroy (&spawn_attr); |