apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1438958 - /apr/apr/trunk/network_io/unix/sendrecv.c
Date Sat, 26 Jan 2013 20:41:54 GMT
Author: sf
Date: Sat Jan 26 20:41:53 2013
New Revision: 1438958

URL: http://svn.apache.org/viewvc?rev=1438958&view=rev
Log:
Only fill in apr_sockaddr_vars_set if we have valid data

Modified:
    apr/apr/trunk/network_io/unix/sendrecv.c

Modified: apr/apr/trunk/network_io/unix/sendrecv.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/sendrecv.c?rev=1438958&r1=1438957&r2=1438958&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/sendrecv.c (original)
+++ apr/apr/trunk/network_io/unix/sendrecv.c Sat Jan 26 20:41:53 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