mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-24 16:41:30 +02:00
[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.
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user