From 84d46adcee6dfdea49f5e156e106abd57b7fc6c7 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 20 May 2024 13:29:26 -0700 Subject: [PATCH] There are only 65536 ports https://github.com/webmin/webmin/discussions/2161 --- fastrpc.cgi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fastrpc.cgi b/fastrpc.cgi index dd747aa27..4c0e885ea 100755 --- a/fastrpc.cgi +++ b/fastrpc.cgi @@ -349,6 +349,9 @@ if ($fh6) { } while(1) { $$port++; + if ($$port >= 65536) { + return "Failed to allocate a free port!"; + } $pack = pack_sockaddr_in($$port, INADDR_ANY); next if (!bind($fh, $pack)); if ($fh6) {