You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2013/05/03 20:51:35 UTC

svn commit: r1478922 - in /apr/apr/branches/1.4.x: ./ network_io/unix/sendrecv.c

Author: sf
Date: Fri May  3 18:51:31 2013
New Revision: 1478922

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

Only fill in apr_sockaddr_vars_set if we have valid data

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

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

Modified: apr/apr/branches/1.4.x/network_io/unix/sendrecv.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/network_io/unix/sendrecv.c?rev=1478922&r1=1478921&r2=1478922&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/network_io/unix/sendrecv.c (original)
+++ apr/apr/branches/1.4.x/network_io/unix/sendrecv.c Fri May  3 18:51:31 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) {