summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-12-25 15:29:18 +0000
committerjilles <jilles@FreeBSD.org>2009-12-25 15:29:18 +0000
commitd5d0bbbb703d2e2ad6cf4820de8b305e85b6fd51 (patch)
treedbde9d571799a754657f25f677aec8b60162fa1c /bin
parent5fd1ddff1a8446e70f03eb86fa6c5f90bf2950a0 (diff)
downloadFreeBSD-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.c9
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 ':':
OpenPOWER on IntegriCloud