diff options
author | jilles <jilles@FreeBSD.org> | 2010-12-30 22:33:55 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-12-30 22:33:55 +0000 |
commit | ca3118f4cab5348e98fb6283d42fca219b5ba6cf (patch) | |
tree | b19941413f90ce2a9c354cf3bdd679a5f201afe2 /secure | |
parent | 12d4883ccf51c51d512fc50f38d6fba359e78fd3 (diff) | |
download | FreeBSD-src-ca3118f4cab5348e98fb6283d42fca219b5ba6cf.zip FreeBSD-src-ca3118f4cab5348e98fb6283d42fca219b5ba6cf.tar.gz |
sh: Avoid side effects from builtins in optimized command substitution.
Change the criterion for builtins to be safe to execute in the same process
in optimized command substitution from a blacklist of only cd, . and eval to
a whitelist.
This avoids clobbering the main shell environment such as by $(exit 4) and
$(set -x).
The builtins jobid, jobs, times and trap can still show information not
available in a child process; this is deliberately permitted. (Changing
traps is not.)
For some builtins, whether they are safe depends on the arguments passed to
them. Some of these are always considered unsafe to keep things simple; this
only harms efficiency a little in the rare case they are used alone in a
command substitution.
Diffstat (limited to 'secure')
0 files changed, 0 insertions, 0 deletions