/* Proxy shell designed for use with Emacs on Windows 95 and NT.
- Copyright (C) 1997, 2001-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2001-2014 Free Software Foundation, Inc.
Accepts subset of Unix sh(1) command-line options, for compatibility
with elisp code written for Unix. When possible, executes external
while (*path)
{
+ size_t len;
+
/* Get next directory from path. */
p = path;
while (*p && *p != ';') p++;
- strncpy (dir, path, p - path);
- dir[p - path] = '\0';
+ /* A broken PATH could have too long directory names in it. */
+ len = min (p - path, sizeof (dir) - 1);
+ strncpy (dir, path, len);
+ dir[len] = '\0';
/* Search the directory for the program. */
if (search_dir (dir, prog, MAX_PATH, absname) > 0)
/* Dequoting can only subtract characters, so the length of the
original command line is a bound on the amount of scratch space
we need. This length, in turn, is bounded by the 32k
- CreateProces limit. */
+ CreateProcess limit. */
char * old_pos = cmdline;
char * new_cmdline = alloca (strlen(cmdline));
char * new_pos = new_cmdline;
return 0;
}
-