summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-10-08 11:22:49 +0000
committertjr <tjr@FreeBSD.org>2002-10-08 11:22:49 +0000
commit33d1a8b9c2dbe4bc22843213ff3044d86bb37710 (patch)
treeca04efa366286bf2ecbc3dd250f40bef3ebcd13c /bin
parentecc00e796caa335a30f92a49f25e5f2b67fda730 (diff)
downloadFreeBSD-src-33d1a8b9c2dbe4bc22843213ff3044d86bb37710.zip
FreeBSD-src-33d1a8b9c2dbe4bc22843213ff3044d86bb37710.tar.gz
Do not strip CTL* escapes from redirection filenames in argstr(); they
are later stripped with rmescapes() in expandarg(). If the filename has already been unescaped, doing it again in rmescapes() can walk off the end of the string, leading to memory corruption and eventually SIGSEGV. Noticed by: kris
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/expand.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index a8cad11..73cedc0 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -213,7 +213,7 @@ STATIC void
argstr(char *p, int flag)
{
char c;
- int quotes = flag & (EXP_FULL | EXP_CASE); /* do CTLESC */
+ int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR); /* do CTLESC */
int firsteq = 1;
if (*p == '~' && (flag & (EXP_TILDE | EXP_VARTILDE)))
OpenPOWER on IntegriCloud