diff options
| author | dtucker@openbsd.org <dtucker@openbsd.org> | 2020-11-12 22:38:57 +0000 |
|---|---|---|
| committer | Darren Tucker <dtucker@dtucker.net> | 2020-11-13 09:58:55 +1100 |
| commit | 819b44e8b9af6ce18d3ec7505b9f461bf7991a1f (patch) | |
| tree | 0a9242ba63abc798dfd1203e4bc64ced192eaede | |
| parent | add926dd1bbe3c4db06e27cab8ab0f9a3d00a0c2 (diff) | |
upstream: Prevent integer overflow when ridiculously large
ConnectTimeout is specified, capping the effective value (for most platforms)
at 24 days. bz#3229, ok djm@
OpenBSD-Commit-ID: 62d4c4b7b87d111045f8e9f28b5b532d17ac5bc0
| -rw-r--r-- | ssh.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.541 2020/11/08 11:46:12 dtucker Exp $ */ +/* $OpenBSD: ssh.c,v 1.542 2020/11/12 22:38:57 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1523,7 +1523,10 @@ main(int ac, char **av) cleanup_exit(255); /* resolve_host logs the error */ } - timeout_ms = options.connection_timeout * 1000; + if (options.connection_timeout >= INT_MAX/1000) + timeout_ms = INT_MAX; + else + timeout_ms = options.connection_timeout * 1000; /* Open a connection to the remote host. */ if (ssh_connect(ssh, host, host_arg, addrs, &hostaddr, options.port, |
