A tilde expansion generates a valid pathname. Splitting it using IFS
either leaves it unchanged or changes it to something unintended.
Example:
IFS=m HOME=/tmp; printf "%s\n" ~
Based on this commit authored by Jilles Tjoelker:
http://git.kernel.org/cgit/utils/dash/dash.git/commit/?id=
834629283f6c629a4da05ef60bae9445c954a19a
Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
struct passwd *pw;
const char *home;
int quotes = flags & (EXP_FULL | EXP_CASE | EXP_REDIR);
- int startloc;
name = p + 1;
if (!home || !*home)
goto lose;
*p = c;
- startloc = expdest - (char *)stackblock();
strtodest(home, SQSYNTAX, quotes);
- recordregion(startloc, expdest - (char *)stackblock(), 0);
return p;
lose:
*p = c;