From: Wayne Davison Date: Mon, 27 Jul 2020 21:42:21 +0000 (-0700) Subject: Don't allow a completely empty source arg. X-Git-Tag: v3.2.3pre1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1e546d67e72a83d6e6b6d9ed54f2a4d7e1a6d27;p=thirdparty%2Frsync.git Don't allow a completely empty source arg. --- diff --git a/NEWS.md b/NEWS.md index 66b88758..0e762c62 100644 --- a/NEWS.md +++ b/NEWS.md @@ -26,6 +26,9 @@ - Rsync now complains about a missing `--temp-dir` before starting any file transfers. + - A completely empty source arg is now a fatal error. This doesn't change + the handling of implied dot-dir args such as "localhost:" and such. + ### ENHANCEMENTS: - Allow `--max-alloc=0` to specify no limit to the alloc sanity check. diff --git a/main.c b/main.c index bfb69797..46b97b58 100644 --- a/main.c +++ b/main.c @@ -1482,8 +1482,15 @@ static int start_client(int argc, char *argv[]) char *dummy_host; int dummy_port = rsync_port; int i; + if (!argv[0][0]) + goto invalid_empty; /* For local source, extra source args must not have hostspec. */ for (i = 1; i < argc; i++) { + if (!argv[i][0]) { + invalid_empty: + rprintf(FERROR, "Empty source arg specified.\n"); + exit_cleanup(RERR_SYNTAX); + } if (check_for_hostspec(argv[i], &dummy_host, &dummy_port)) { rprintf(FERROR, "Unexpected remote arg: %s\n", argv[i]); exit_cleanup(RERR_SYNTAX);