pytest: bind to localhost

Pointed out by CodeQL

Fixes https://github.com/curl/curl/security/code-scanning/298

Closes #18506
This commit is contained in:
Viktor Szakats 2025-09-09 22:40:02 +02:00
parent 82449d4d91
commit 61759a9843
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201

View file

@ -41,7 +41,7 @@ def alloc_port_set(port_specs: Dict[str, int]) -> Dict[str, int]:
for name, ptype in port_specs.items():
try:
s = socket.socket(type=ptype)
s.bind(('', 0))
s.bind(('127.0.0.1', 0))
ports[name] = s.getsockname()[1]
socks.append(s)
except Exception as e: