mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix GH-12190: stream_context_create with address and port at 0.
Prior to the 8.1 rewrite, inet_aton was used for ipv4 addresses therefore addresses like `0` passed. For the bindto's case where both ip and port are set as such, we discard the address binding. Close GH-12195
This commit is contained in:
parent
d93800ec0f
commit
d65c80031a
3 changed files with 19 additions and 1 deletions
|
@ -835,7 +835,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
|
|||
case AF_INET:
|
||||
((struct sockaddr_in *)sa)->sin_port = htons(port);
|
||||
socklen = sizeof(struct sockaddr_in);
|
||||
if (bindto && strchr(bindto, ':')) {
|
||||
if (bindto && (strchr(bindto, ':') || !strcmp(bindto, "0"))) {
|
||||
/* IPV4 sock can not bind to IPV6 address */
|
||||
bindto = NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue