sh: Do not consider a tilde-prefix with expansions in it.

That is, do not do tilde expansion if any of the CTL* bytes (\201-\210), not
only CTLESC and CTLQUOTEMARK, are encountered. Such an expansion would look
up a user name with sh's internal representation.

The parser does not currently distinguish between backslashed and
unbackslashed \201-\210, so tilde expansion of user names with these bytes
in them is not so easy to fix.
This commit is contained in:
Jilles Tjoelker 2009-12-25 15:29:18 +00:00
parent 10a290af39
commit 05c10507e9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=200988

View File

@ -271,8 +271,13 @@ exptilde(char *p, int flag)
while ((c = *p) != '\0') {
switch(c) {
case CTLESC:
return (startp);
case CTLESC: /* This means CTL* are always considered quoted. */
case CTLVAR:
case CTLENDVAR:
case CTLBACKQ:
case CTLBACKQ | CTLQUOTE:
case CTLARI:
case CTLENDARI:
case CTLQUOTEMARK:
return (startp);
case ':':