aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-05-05 15:54:20 +0000
committerWayne Davison <wayned@samba.org>2006-05-05 15:54:20 +0000
commit89363676953c674450b68e9133193da83702e8a8 (patch)
treef94706eaa5525be9f1e9222a9ca4ee9c53c2a0b9 /util.c
parent8517e9c10a95390d749d8411bcdee052bcad9def (diff)
downloadandroid_external_rsync-89363676953c674450b68e9133193da83702e8a8.tar.gz
android_external_rsync-89363676953c674450b68e9133193da83702e8a8.tar.bz2
android_external_rsync-89363676953c674450b68e9133193da83702e8a8.zip
- Added a call to die_on_unsafe_path() to handle_partial_dir().
- Fixed some strange slash handling in partial_dir_fname().
Diffstat (limited to 'util.c')
-rw-r--r--util.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/util.c b/util.c
index 337aa83f..12b88edd 100644
--- a/util.c
+++ b/util.c
@@ -1066,13 +1066,11 @@ char *partial_dir_fname(const char *fname)
if ((int)pathjoin(t, sz, partial_dir, fn) >= sz)
return NULL;
if (server_filter_list.head) {
- static int len;
- if (!len)
- len = strlen(partial_dir);
- t[len] = '\0';
+ t = strrchr(partial_fname, '/');
+ *t = '\0';
if (check_filter(&server_filter_list, partial_fname, 1) < 0)
return NULL;
- t[len] = '/';
+ *t = '/';
if (check_filter(&server_filter_list, partial_fname, 0) < 0)
return NULL;
}
@@ -1098,6 +1096,8 @@ int handle_partial_dir(const char *fname, int create)
if (create) {
STRUCT_STAT st;
int statret = do_lstat(dir, &st);
+ if (sanitize_paths && *partial_dir != '/')
+ die_on_unsafe_path(dir, 1); /* lstat handles last element */
if (statret == 0 && !S_ISDIR(st.st_mode)) {
if (do_unlink(dir) < 0)
return 0;