Skip to content

Commit 22f62df

Browse files
committed
Fix windows Socket::connect_timeout overflow
Signed-off-by: Eval EXEC <[email protected]>
1 parent e1c29d1 commit 22f62df

File tree

1 file changed

+1
-1
lines changed
  • library/std/src/sys/windows

1 file changed

+1
-1
lines changed

library/std/src/sys/windows/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Socket {
159159
}
160160

161161
let mut timeout = c::timeval {
162-
tv_sec: timeout.as_secs() as c_long,
162+
tv_sec: cmp::min(timeout.as_secs(), c_long::MAX as u64) as c_long,
163163
tv_usec: (timeout.subsec_nanos() / 1000) as c_long,
164164
};
165165

0 commit comments

Comments
 (0)