Commit 647c32eb authored by Karl Heuer's avatar Karl Heuer

(run_msdos_command): Make local copy of argv[2] on stack, not on heap.

(run_msdos_command): When changing argv[2] from using slashes to
using backslashes, only do so on the first white-space delimited part.
parent 6873cfa3
......@@ -527,11 +527,20 @@ run_msdos_command (argv, dir, tempin, tempout)
if (msshell)
{
saveargv1 = argv[1];
saveargv2 = argv[2];
argv[1] = "/c";
if (argv[2])
{
saveargv2 = argv[2];
unixtodos_filename (argv[2] = strdup (argv[2]));
char *p = alloca (strlen (argv[2]) + 1);
strcpy (argv[2] = p, saveargv2);
while (*p && isspace (*p))
p++;
while (*p && !isspace (*p))
if (*p == '/')
*p++ = '\\';
else
p++;
}
}
......@@ -578,11 +587,7 @@ run_msdos_command (argv, dir, tempin, tempout)
if (msshell)
{
argv[1] = saveargv1;
if (argv[2])
{
free (argv[2]);
argv[2] = saveargv2;
}
argv[2] = saveargv2;
}
return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment