Skip to content

Commit 249dc7f

Browse files
authored
Merge pull request #26 from BetterMint/alert-autofix-12
Potential fix for code scanning alert no. 12: Binding a socket to all network interfaces
2 parents e13dbad + fca3873 commit 249dc7f

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)