Skip to content

Fix connecting to localhost on non-standard ports

Hanicef requested to merge Hanicef/SRB2:fix-localhost-nonstandard-port into next

When connecting to a dotless domain (localhost, for example), the connection would fail if the server was hosted on a non-standard port, even if you explicitly specify the correct port. The cause of this is due to a bad check inside I_NetSplitAddress which checks for dots instead of the brackets that IPv6 uses. On dotless domains, though, there are no dots, and as such, it will incorrectly treat it as an IPv6 address and ultimately fail to determine the port component of the address.

This patch fixes it by just checking for the brackets instead, since those are required for an IPv6 address and exists specifically to solve this exact problem.

Merge request reports

Loading