summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2010-12-23 09:26:39 -0800
committerWayne Davison <wayned@samba.org>2010-12-23 22:09:45 -0800
commit8f30d215843a58e159335158dd2e060560479b60 (patch)
treed6cd0e31d55a648442dfb5921c85445e7ac28019 /main.c
parent3f770ab0a5922604392808109fb778d31ec78bf2 (diff)
downloadrsync-8f30d215843a58e159335158dd2e060560479b60.tar.gz
rsync-8f30d215843a58e159335158dd2e060560479b60.tar.bz2
rsync-8f30d215843a58e159335158dd2e060560479b60.zip
Protect a remote filename that starts with a dash.
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.c b/main.c
index 161bfad8..649aa904 100644
--- a/main.c
+++ b/main.c
@@ -493,7 +493,11 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
rprintf(FERROR, "internal: args[] overflowed in do_cmd()\n");
exit_cleanup(RERR_SYNTAX);
}
- args[argc++] = *remote_argv++;
+ if (**remote_argv == '-') {
+ if (asprintf(args + argc++, "./%s", *remote_argv++) < 0)
+ out_of_memory("do_cmd");
+ } else
+ args[argc++] = *remote_argv++;
remote_argc--;
}
}