diff options
| author | Eval EXEC <execvy@gmail.com> | 2023-06-09 21:45:57 +0800 |
|---|---|---|
| committer | Eval EXEC <execvy@gmail.com> | 2023-06-18 01:56:11 +0800 |
| commit | 22f62df337b015df73104d24999e6f4e30f18d14 (patch) | |
| tree | 5a4a00b751832dd9df659ea7e44488334a82e91d | |
| parent | e1c29d137dd779dcfce447d8d149ee6b8e9bdf78 (diff) | |
| download | rust-22f62df337b015df73104d24999e6f4e30f18d14.tar.gz rust-22f62df337b015df73104d24999e6f4e30f18d14.zip | |
Fix windows `Socket::connect_timeout` overflow
Signed-off-by: Eval EXEC <execvy@gmail.com>
| -rw-r--r-- | library/std/src/sys/windows/net.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/sys/windows/net.rs b/library/std/src/sys/windows/net.rs index 2404bbe2b89..1ae42cb7eae 100644 --- a/library/std/src/sys/windows/net.rs +++ b/library/std/src/sys/windows/net.rs @@ -159,7 +159,7 @@ impl Socket { } let mut timeout = c::timeval { - tv_sec: timeout.as_secs() as c_long, + tv_sec: cmp::min(timeout.as_secs(), c_long::MAX as u64) as c_long, tv_usec: (timeout.subsec_nanos() / 1000) as c_long, }; |
