diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-07-07 07:14:58 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-07-07 07:14:58 -0700 |
commit | 8da90498684e5dc90870601dc520d8597e09788d (patch) | |
tree | 129b97b7cace261f390863242dff3f594cba566d /winsup/cygwin/cpuid.h | |
parent | a10a8241f40f24d965e6fdd866d1ee07da4cb4f0 (diff) | |
download | cygnal-8da90498684e5dc90870601dc520d8597e09788d.tar.gz cygnal-8da90498684e5dc90870601dc520d8597e09788d.tar.bz2 cygnal-8da90498684e5dc90870601dc520d8597e09788d.zip |
More secure way of obtaining command interpreter.
Instead of relying on the COMSPEC environment variable,
what we can do is assume that the program is called "cmd.exe",
and then look for it in the directory reported by the
GetSystemDirectoryA Win32 function in kernel32.dll.
* winsup/cygwin/path.h (get_cmd_exe_path): New function declared.
* winsup/cygwin/spawn.cc (av::setup): Use get_cmd_exe_path
instead of getenv("COMSPEC").
(cmd_exe_path): New static variable.
(init_cmd_exe_path): New static function.
(get_cmd_exe_path): New function.
* winsup/cygwin/syscalls.cc (system, getusershell, popen): Use
get_cmd_exe_path instead of getenv("COMSPEC").
Diffstat (limited to 'winsup/cygwin/cpuid.h')
0 files changed, 0 insertions, 0 deletions