+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.
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 */
&& !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)
{
&& 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
)
{
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;