comparison src/fileio.c @ 100610:ee0ea39bc6a3

(Fexpand_file_name): Do not allow ../ to go beyond the server name in UNC paths.
author Jason Rumney <jasonr@gnu.org>
date Sat, 20 Dec 2008 15:17:28 +0000
parents ae79259858c8
children 24b031f24662
comparison
equal deleted inserted replaced
100609:4f0bbd8c0ac6 100610:ee0ea39bc6a3
1321 #ifndef DOS_NT 1321 #ifndef DOS_NT
1322 && o != target 1322 && o != target
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;
1331 p += 3; 1341 p += 3;
1332 } 1342 }