Don't allow a completely empty source arg.
authorWayne Davison <wayne@opencoder.net>
Mon, 27 Jul 2020 21:42:21 +0000 (14:42 -0700)
committerWayne Davison <wayne@opencoder.net>
Mon, 27 Jul 2020 21:49:51 +0000 (14:49 -0700)
NEWS.md
main.c

diff --git a/NEWS.md b/NEWS.md
index 66b887588f4dedf8f7b767278f25ea55fa95497f..0e762c623e01536bcc95a786394c0527ed8ff611 100644 (file)
--- 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 bfb69797f8520ddfd2d63a5da16ca16336006476..46b97b58df23235dad543195229d13ef5a3b80ef 100644 (file)
--- 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);