X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/7a16e12207b65010dc2f0c05dc87a9690c9ed87b..51cc96e469058f94666ffbb080024ef9981d0ac1:/flist.c diff --git a/flist.c b/flist.c index 29d75cab..ad02b898 100644 --- a/flist.c +++ b/flist.c @@ -1120,11 +1120,21 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) if (l == 2 && fname[0] == '.') { /* Turn "./" into just "." rather than "./." */ fname[1] = '\0'; - } else if (l < MAXPATHLEN) { + } else { + if (l + 1 >= MAXPATHLEN) + overflow("send_file_list"); fname[l++] = '.'; 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] == '/');