apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1478918 - in /apr/apr/branches/1.5.x: ./ network_io/unix/sendrecv.c
Date Fri, 03 May 2013 18:50:21 GMT
Author: sf
Date: Fri May  3 18:50:21 2013
New Revision: 1478918

URL: http://svn.apache.org/r1478918
Log:
Merge r1438958:

Only fill in apr_sockaddr_vars_set if we have valid data

Modified:
    apr/apr/branches/1.5.x/   (props changed)
    apr/apr/branches/1.5.x/network_io/unix/sendrecv.c

Propchange: apr/apr/branches/1.5.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1438958

Modified: apr/apr/branches/1.5.x/network_io/unix/sendrecv.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/unix/sendrecv.c?rev=1478918&r1=1478917&r2=1478918&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/network_io/unix/sendrecv.c (original)
+++ apr/apr/branches/1.5.x/network_io/unix/sendrecv.c Fri May  3 18:50:21 2013
@@ -174,7 +174,14 @@ apr_status_t apr_socket_recvfrom(apr_soc
         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) {



Mime
View raw message