X-Git-Url: https://git.proxmox.com/?p=pve-xtermjs.git;a=blobdiff_plain;f=termproxy%2Fsrc%2Fmain.rs;fp=termproxy%2Fsrc%2Fmain.rs;h=e9181fbce173b0fb5c5e024f6df77c91216d0f95;hp=5eb14ee3585c3e1bf0d517f51dcddc869abb5785;hb=749ebb0907293a9f1cf0f5074e0a240f39f94f6f;hpb=f451fe27686b21ef43d7521cb8136e683612422e diff --git a/termproxy/src/main.rs b/termproxy/src/main.rs index 5eb14ee..e9181fb 100644 --- a/termproxy/src/main.rs +++ b/termproxy/src/main.rs @@ -278,10 +278,10 @@ fn do_main() -> Result<()> { let authport: u16 = *matches.get_one("authport").unwrap_or(&85); let use_port_as_fd = matches.contains_id("use-port-as-fd"); - if use_port_as_fd && port > u16::MAX as u64 { - return Err(format_err!("port too big")); - } else if port > i32::MAX as u64 { - return Err(format_err!("Invalid FD number")); + if use_port_as_fd && port > std::os::fd::RawFd::MAX as u64 { + return Err(format_err!("FD too big")); + } else if !use_port_as_fd && port > u16::MAX as u64 { + return Err(format_err!("invalid port number")); } let (mut tcp_handle, port) =