From: Viktor Szakats Date: Tue, 9 Sep 2025 20:40:02 +0000 (+0200) Subject: pytest: bind to localhost X-Git-Tag: curl-8_16_0~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61759a9843d44d9001f6a3c1bc88731448da58f4;p=thirdparty%2Fcurl.git pytest: bind to localhost Pointed out by CodeQL Fixes https://github.com/curl/curl/security/code-scanning/298 Closes #18506 --- diff --git a/tests/http/testenv/ports.py b/tests/http/testenv/ports.py index 97159eb0cc..f3d2348fa6 100644 --- a/tests/http/testenv/ports.py +++ b/tests/http/testenv/ports.py @@ -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: