]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fexpand_file_name): Do not allow ../ to go beyond the server name in
authorJason Rumney <jasonr@gnu.org>
Sat, 20 Dec 2008 15:17:28 +0000 (15:17 +0000)
committerJason Rumney <jasonr@gnu.org>
Sat, 20 Dec 2008 15:17:28 +0000 (15:17 +0000)
UNC paths.

src/fileio.c

index 998dc974c47b1b0c5252155545f9a2bee9d85a4a..e358c3f781e7e12e7264f19ecb2780d91ee69569 100644 (file)
@@ -1323,8 +1323,18 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
 #endif
                 && (IS_DIRECTORY_SEP (p[3]) || p[3] == 0))
          {
+#ifdef WINDOWSNT
+           unsigned char *prev_o = o;
+#endif
            while (o != target && (--o) && !IS_DIRECTORY_SEP (*o))
              ;
+#ifdef WINDOWSNT
+           /* Don't go below server level in UNC filenames.  */
+           if (o == target + 1 && IS_DIRECTORY_SEP (*o)
+               && IS_DIRECTORY_SEP (*target))
+             o = prev_o;
+           else
+#endif
            /* Keep initial / only if this is the whole name.  */
            if (o == target && IS_ANY_SEP (*o) && p[3] == 0)
              ++o;