diff options
author | jilles <jilles@FreeBSD.org> | 2009-12-25 15:29:18 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2009-12-25 15:29:18 +0000 |
commit | d5d0bbbb703d2e2ad6cf4820de8b305e85b6fd51 (patch) | |
tree | dbde9d571799a754657f25f677aec8b60162fa1c /bin | |
parent | 5fd1ddff1a8446e70f03eb86fa6c5f90bf2950a0 (diff) | |
download | FreeBSD-src-d5d0bbbb703d2e2ad6cf4820de8b305e85b6fd51.zip FreeBSD-src-d5d0bbbb703d2e2ad6cf4820de8b305e85b6fd51.tar.gz |
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.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/expand.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index db86dac..5faf807 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -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 ':': |