1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-05-27 23:56:04 -07:00

(Fexpand_file_name): Do not allow ../ to go beyond the server name in

UNC paths.
This commit is contained in:
Jason Rumney 2008-12-20 15:17:28 +00:00
parent 1e9340df3d
commit 972ed2462a

View 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;