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
This commit is contained in:
Tim J. Robbins 2002-10-08 11:22:49 +00:00
parent ae02ceb621
commit c121fd80b8

View File

@ -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)))