From: Wayne Davison Date: Sat, 14 May 2005 18:44:57 +0000 (+0000) Subject: Treat a trailing ".." dir-name as if "../" had been specified so X-Git-Tag: v2.6.5pre2~13 X-Git-Url: http://git.samba.org/samba.git/?p=rsync.git;a=commitdiff_plain;h=a289f89fbe92410d2a875481197a75668bd31656 Treat a trailing ".." dir-name as if "../" had been specified so that we don't use the name in the destination path and save files into a higher destination directory. --- diff --git a/flist.c b/flist.c index b3c966ed..ad02b898 100644 --- a/flist.c +++ b/flist.c @@ -1127,6 +1127,14 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) fname[l] = '\0'; } is_dot_dir = 1; + } else if (l > 1 && fname[l-1] == '.' && fname[l-2] == '.' + && (l == 2 || fname[l-3] == '/')) { + if (l + 2 >= MAXPATHLEN) + overflow("send_file_list"); + fname[l++] = '/'; + fname[l++] = '.'; + fname[l] = '\0'; + is_dot_dir = 1; } else { is_dot_dir = fname[l-1] == '.' && (l == 1 || fname[l-2] == '/');