diff options
| author | Wayne Davison <wayned@samba.org> | 2017-10-29 15:22:22 -0700 |
|---|---|---|
| committer | Wayne Davison <wayned@samba.org> | 2017-10-29 15:52:56 -0700 |
| commit | 0350f95e7bfd0fc6c444682f16e0c9af32874eac (patch) | |
| tree | a998263e2969f70f82b5ed96429b843f5af05baf | |
| parent | 9a480deec4d20277d8e20bc55515ef0640ca1e55 (diff) | |
| download | android_external_rsync-0350f95e7bfd0fc6c444682f16e0c9af32874eac.tar.gz android_external_rsync-0350f95e7bfd0fc6c444682f16e0c9af32874eac.tar.bz2 android_external_rsync-0350f95e7bfd0fc6c444682f16e0c9af32874eac.zip | |
Add an extra argc validation in do_server_sender().
Fixes bug 13104.
| -rw-r--r-- | main.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -783,7 +783,7 @@ static void read_final_goodbye(int f_in, int f_out) static void do_server_sender(int f_in, int f_out, int argc, char *argv[]) { struct file_list *flist; - char *dir = argv[0]; + char *dir; if (DEBUG_GTE(SEND, 1)) rprintf(FINFO, "server_sender starting pid=%d\n", (int)getpid()); @@ -791,16 +791,19 @@ static void do_server_sender(int f_in, int f_out, int argc, char *argv[]) if (am_daemon && lp_write_only(module_id)) { rprintf(FERROR, "ERROR: module is write only\n"); exit_cleanup(RERR_SYNTAX); - return; } if (am_daemon && read_only && remove_source_files) { rprintf(FERROR, - "ERROR: --remove-%s-files cannot be used with a read-only module\n", - remove_source_files == 1 ? "source" : "sent"); + "ERROR: --remove-%s-files cannot be used with a read-only module\n", + remove_source_files == 1 ? "source" : "sent"); + exit_cleanup(RERR_SYNTAX); + } + if (argc < 1) { + rprintf(FERROR, "ERROR: do_server_sender called without args\n"); exit_cleanup(RERR_SYNTAX); - return; } + dir = argv[0]; if (!relative_paths) { if (!change_dir(dir, CD_NORMAL)) { rsyserr(FERROR, errno, "change_dir#3 %s failed", |
