cf-socket: use the right byte order for ports in bindlocal

Reported in Joshua's sarif data

Closes #18641
This commit is contained in:
Daniel Stenberg 2025-09-20 16:56:14 +02:00
parent 94eec0a788
commit d27d9c7ef1
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -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