Commit cb8b26b4 authored by Eli Zaretskii's avatar Eli Zaretskii

Fix bug #16751 with crashes in expand-file-name on Windows.

 src/fileio.c (Fexpand_file_name) [WINDOWSNT]: Don't treat file names
 that start with more than 2 slashes as UNCs.
parent 504d5d5f
2014-03-01 Eli Zaretskii <eliz@gnu.org>
* fileio.c (Fexpand_file_name) [WINDOWSNT]: Don't treat file names
that start with more than 2 slashes as UNCs. (Bug#16751)
2014-02-28 Paul Eggert <eggert@penguin.cs.ucla.edu>
Fix a few crashes and leaks when cloning C strings.
......
......@@ -1047,10 +1047,9 @@ filesystem tree, not (expand-file-name ".." dirname). */)
nm++;
/* Discard any previous drive specifier if nm is now in UNC format. */
if (IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1]))
{
drive = 0;
}
if (IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1])
&& !IS_DIRECTORY_SEP (nm[2]))
drive = 0;
#endif /* WINDOWSNT */
#endif /* DOS_NT */
......@@ -1261,7 +1260,8 @@ filesystem tree, not (expand-file-name ".." dirname). */)
&& !IS_DIRECTORY_SEP (nm[0])
#endif
#ifdef WINDOWSNT
&& !(IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1]))
&& !(IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1])
&& !IS_DIRECTORY_SEP (nm[2]))
#endif
&& !newdir)
{
......@@ -1286,7 +1286,8 @@ filesystem tree, not (expand-file-name ".." dirname). */)
&& IS_DEVICE_SEP (newdir[1]) && IS_DIRECTORY_SEP (newdir[2]))
#ifdef WINDOWSNT
/* Detect Windows file names in UNC format. */
&& ! (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1]))
&& ! (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1])
&& !IS_DIRECTORY_SEP (newdir[2]))
#endif
)
{
......@@ -1346,7 +1347,8 @@ filesystem tree, not (expand-file-name ".." dirname). */)
if (IS_DIRECTORY_SEP (nm[0]) && collapse_newdir)
{
#ifdef WINDOWSNT
if (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1]))
if (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1])
&& !IS_DIRECTORY_SEP (newdir[2]))
{
char *adir = strcpy (alloca (strlen (newdir) + 1), newdir);
char *p = adir + 2;
......
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