]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
main: reject hyphen-prefixed remote-shell hostnames
authorAndrew Tridgell <andrew@tridgell.net>
Fri, 15 May 2026 00:17:03 +0000 (10:17 +1000)
committerAndrew Tridgell <andrew@tridgell.net>
Wed, 20 May 2026 00:01:22 +0000 (10:01 +1000)
main.c

diff --git a/main.c b/main.c
index 8c6718eb3130594f74327194f0809f32880002be..78f0b8331bdc1aac5ce6183badf5bfe267836ec2 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1568,6 +1568,10 @@ static int start_client(int argc, char *argv[])
                        shell_user = shell_machine;
                        shell_machine = p+1;
                }
+               if (*shell_machine == '-') {
+                       rprintf(FERROR, "Invalid remote host: hostnames may not start with '-'.\n");
+                       exit_cleanup(RERR_SYNTAX);
+               }
        }
 
        if (DEBUG_GTE(CMD, 2)) {