Skip to content

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Mar 9, 2020

This is actually about three distinct issues:

  • If an empty string is passed as $address to stream_socket_sendto(),
    the sa is not initialized, so we must not pass it as addr to
    php_stream_xport_sendto().

  • On POSIX, recvfrom() truncates messages which are too long to fit
    into the specified buffer (unless MSG_PEEK is given), discards the
    excessive bytes, and returns the buffer length. On Windows, the same
    happens, but recvfrom() returns SOCKET_ERROR with the error code
    WSAEMSGSIZE. We have to catch this for best POSIX compatibility.

  • In php_network_parse_network_address_with_port(), we have to zero
    in6 (not only its alias sa) to properly support IPv6.

cmb69 added 2 commits March 9, 2020 14:47
This is actually about three distinct issues:

* If an empty string is passed as $address to `stream_socket_sendto()`,
  the `sa` is not initialized, so we must not pass it as `addr` to
  `php_stream_xport_sendto()`.

* On POSIX, `recvfrom()` truncates messages which are too long to fit
  into the specified buffer (unless `MSG_PEEK` is given), discards the
  excessive bytes, and returns the buffer length.  On Windows, the same
  happens, but `recvfrom()` returns `SOCKET_ERROR` with the error code
  `WSAEMSGSIZE`.  We have to catch this for best POSIX compatibility.

* In `php_network_parse_network_address_with_port()`, we have to zero
  `in6` (not only its alias `sa`) to properly support IPv6.
@cmb69 cmb69 added the Bug label Mar 9, 2020
Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
@cmb69
Copy link
Member Author

cmb69 commented Mar 11, 2020

Thanks! Applied as 53797c2.

@cmb69 cmb69 closed this Mar 11, 2020
@cmb69 cmb69 deleted the cmb/78210 branch March 11, 2020 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants