Sanitize xname in read_ndx_and_attrs.
authorJeriko One <jeriko.one@gmx.us>
Fri, 17 Nov 2017 01:05:42 +0000 (17:05 -0800)
committerWayne Davison <wayned@samba.org>
Mon, 4 Dec 2017 00:13:05 +0000 (16:13 -0800)
rsync.c

diff --git a/rsync.c b/rsync.c
index b82e59881018a906ce91451674ee5e3e7c658a1e..a0945ba4e7f5a154854d12e16f193145d9d0b7b1 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -49,6 +49,7 @@ extern int flist_eof;
 extern int file_old_total;
 extern int keep_dirlinks;
 extern int make_backups;
 extern int file_old_total;
 extern int keep_dirlinks;
 extern int make_backups;
+extern int sanitize_paths;
 extern struct file_list *cur_flist, *first_flist, *dir_flist;
 extern struct chmod_mode_struct *daemon_chmod_modes;
 #ifdef ICONV_OPTION
 extern struct file_list *cur_flist, *first_flist, *dir_flist;
 extern struct chmod_mode_struct *daemon_chmod_modes;
 #ifdef ICONV_OPTION
@@ -396,6 +397,11 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr,
        if (iflags & ITEM_XNAME_FOLLOWS) {
                if ((len = read_vstring(f_in, buf, MAXPATHLEN)) < 0)
                        exit_cleanup(RERR_PROTOCOL);
        if (iflags & ITEM_XNAME_FOLLOWS) {
                if ((len = read_vstring(f_in, buf, MAXPATHLEN)) < 0)
                        exit_cleanup(RERR_PROTOCOL);
+
+               if (sanitize_paths) {
+                       sanitize_path(buf, buf, "", 0, SP_DEFAULT);
+                       len = strlen(buf);
+               }
        } else {
                *buf = '\0';
                len = -1;
        } else {
                *buf = '\0';
                len = -1;