From a33e981c268bb7d0e1636bca58007c1de7ff87f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Tue, 11 Aug 2026 15:05:58 +0200 Subject: [PATCH] [android] reject an out-of-range SSH port The port arrives as an int because gomobile cannot carry uint16 across the Java boundary, so nothing rejected a value outside the valid range. It reached strconv.Itoa and only surfaced as a dial failure, after the server detection had already spent its timeout. --- client/android/ssh_client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/android/ssh_client.go b/client/android/ssh_client.go index b382744c8..9c612c91c 100644 --- a/client/android/ssh_client.go +++ b/client/android/ssh_client.go @@ -115,6 +115,10 @@ func (s *SSHClient) SetURLOpener(opener URLOpener) { // // The password parameter is only consulted for regular SSH servers. func (s *SSHClient) Connect(host string, port int, user, password string) error { + if port < 1 || port > 65535 { + return fmt.Errorf("invalid port: %d", port) + } + cfg, _, cc := s.nb.stateSnapshot() if cc == nil { return errors.New("netbird client not running")