Skip to content

Commit fca3873

Browse files
Potential fix for code scanning alert no. 12: Binding a socket to all network interfaces
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 04f141d commit fca3873

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

BetterMITM/net/free_port.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def get_free_port() -> int:
1212
udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
1313

1414
try:
15-
tcp.bind(("", 0))
15+
tcp.bind(("127.0.0.1", 0))
1616
port: int = tcp.getsockname()[1]
17-
udp.bind(("", port))
17+
udp.bind(("127.0.0.1", port))
1818
udp.close()
1919
return port
2020
except OSError:

0 commit comments

Comments
 (0)