sh: Do not import IFS's value from the environment.
authorjilles <jilles@FreeBSD.org>
Sat, 8 Oct 2016 13:40:12 +0000 (13:40 +0000)
committerjilles <jilles@FreeBSD.org>
Sat, 8 Oct 2016 13:40:12 +0000 (13:40 +0000)
commit71c26f702afb0ffc231141ebec5efc119aa415ba
tree8edb037948f5e55d05e834ede9b6a5f81b07a9d7
parent4a50f751554b382d19cedef1d2314e5c949ba1fe
sh: Do not import IFS's value from the environment.

Per Austin group issue #884, always set IFS to $' \t\n'. As before, IFS will
be exported iff it was in the environment.

Most shells (e.g. bash, ksh93 and mksh) already did this. This change
improves predictability, in that scripts can simply rely on the default
value.

However, the effect on security is little, since applications should not be
calling the shell with attacker-controlled environment variable names in the
first place and other security-sensitive variables such as PATH should be
and are imported by the shell.

When using a new sh with an old (before 10.2) libc wordexp(), IFS is no
longer passed on. Otherwise, wordexp() continues to pass along IFS from the
environment per its documentation.

Discussed with: pfg
Relnotes: yes
bin/sh/sh.1
bin/sh/tests/parameters/Makefile
bin/sh/tests/parameters/ifs1.0 [new file with mode: 0644]
bin/sh/var.c