Skip to content

Commit

Permalink
Replicate r983618 in Win32 code.
Browse files Browse the repository at this point in the history
* network_io/win32/sockets.c:
  (apr_socket_connect): Copy the remote address by value rather than by
  reference.  This ensures that the sockaddr object returned by
  apr_socket_addr_get is allocated from the same pool as the socket object
  itself, as apr_socket_accept does; avoiding any potential lifetime mismatches.


git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1920061 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Ivan Zhakov committed Aug 20, 2024
1 parent cd3698c commit cd2f704
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion network_io/win32/sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock,
sock->remote_addr_unknown = 0;

/* Copy the address structure details in. */
sock->remote_addr = sa;
sock->remote_addr->sa = sa->sa;
sock->remote_addr->salen = sa->salen;
/* Adjust ipaddr_ptr et al. */
apr_sockaddr_vars_set(sock->remote_addr, sa->family, sa->port);
}

if (sock->local_addr->sa.sin.sin_port == 0) {
Expand Down

0 comments on commit cd2f704

Please sign in to comment.