diff options
author | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2013-05-03 18:50:21 +0000 |
---|---|---|
committer | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2013-05-03 18:50:21 +0000 |
commit | e11d8d677e874daa2ee25de4474ff1f23cfd2fea (patch) | |
tree | 81e2442b84a8d7424682a40ffba0763de624e622 /network_io | |
parent | b97a5d868e1bcb8b08c79bb490d36bed3ea5d878 (diff) | |
download | libapr-e11d8d677e874daa2ee25de4474ff1f23cfd2fea.tar.gz |
Merge r1438958:
Only fill in apr_sockaddr_vars_set if we have valid data
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1478918 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r-- | network_io/unix/sendrecv.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c index 6f5ec5030..bbe376ac2 100644 --- a/network_io/unix/sendrecv.c +++ b/network_io/unix/sendrecv.c @@ -174,7 +174,14 @@ apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, return errno; } - apr_sockaddr_vars_set(from, from->sa.sin.sin_family, ntohs(from->sa.sin.sin_port)); + /* + * Check if we have a valid address. recvfrom() with MSG_PEEK may return + * success without filling in the address. + */ + if (from->salen > APR_OFFSETOF(struct sockaddr_in, sin_port)) { + apr_sockaddr_vars_set(from, from->sa.sin.sin_family, + ntohs(from->sa.sin.sin_port)); + } (*len) = rv; if (rv == 0 && sock->type == SOCK_STREAM) { |