From 765d7446cc1d440defef88be0d61544da802a90d Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <andrew@tridgell.net>
Date: Fri, 15 May 2026 10:17:03 +1000
Subject: [PATCH 42/43] main: reject hyphen-prefixed remote-shell hostnames

---
 main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/main.c b/main.c
index 549b1da5..47b02f4f 100644
--- 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)) {
-- 
2.51.0

