From: Daniel Stenberg Date: Sat, 20 Sep 2025 14:56:14 +0000 (+0200) Subject: cf-socket: use the right byte order for ports in bindlocal X-Git-Tag: rc-8_17_0-1~314 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d27d9c7ef1a37230ace8cc841027e6622c885df7;p=thirdparty%2Fcurl.git cf-socket: use the right byte order for ports in bindlocal Reported in Joshua's sarif data Closes #18641 --- diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 365ddb62a1..2f0429efea 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -790,10 +790,10 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, infof(data, "Bind to local port %d failed, trying next", port - 1); /* We reuse/clobber the port variable here below */ if(sock->sa_family == AF_INET) - si4->sin_port = ntohs(port); + si4->sin_port = htons(port); #ifdef USE_IPV6 else - si6->sin6_port = ntohs(port); + si6->sin6_port = htons(port); #endif } else