aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2008-12-20 15:17:28 +0000
committerJason Rumney2008-12-20 15:17:28 +0000
commit972ed2462a24213f68acda61d43e60f3ad6502b9 (patch)
tree99acebd88cfc98d4810f2c4966b2fcfffbf5e1ef /src
parent1e9340df3d594e9faa56b328ac6bf10567f925c1 (diff)
downloademacs-972ed2462a24213f68acda61d43e60f3ad6502b9.tar.gz
emacs-972ed2462a24213f68acda61d43e60f3ad6502b9.zip
(Fexpand_file_name): Do not allow ../ to go beyond the server name in
UNC paths.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 998dc974c47..e358c3f781e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1323,8 +1323,18 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1323#endif 1323#endif
1324 && (IS_DIRECTORY_SEP (p[3]) || p[3] == 0)) 1324 && (IS_DIRECTORY_SEP (p[3]) || p[3] == 0))
1325 { 1325 {
1326#ifdef WINDOWSNT
1327 unsigned char *prev_o = o;
1328#endif
1326 while (o != target && (--o) && !IS_DIRECTORY_SEP (*o)) 1329 while (o != target && (--o) && !IS_DIRECTORY_SEP (*o))
1327 ; 1330 ;
1331#ifdef WINDOWSNT
1332 /* Don't go below server level in UNC filenames. */
1333 if (o == target + 1 && IS_DIRECTORY_SEP (*o)
1334 && IS_DIRECTORY_SEP (*target))
1335 o = prev_o;
1336 else
1337#endif
1328 /* Keep initial / only if this is the whole name. */ 1338 /* Keep initial / only if this is the whole name. */
1329 if (o == target && IS_ANY_SEP (*o) && p[3] == 0) 1339 if (o == target && IS_ANY_SEP (*o) && p[3] == 0)
1330 ++o; 1340 ++o;