summaryrefslogtreecommitdiffstats
path: root/modules/proxy/mod_proxy_fdpass.c
diff options
context:
space:
mode:
authorChristophe Jaillet <jailletc36@apache.org>2014-06-01 08:54:15 +0200
committerChristophe Jaillet <jailletc36@apache.org>2014-06-01 08:54:15 +0200
commit68b56009d5c0a581a1d472c09647597e2ddb5a47 (patch)
tree0e315dad0622972fa8fc4c5d1893ca8703733916 /modules/proxy/mod_proxy_fdpass.c
parentupdate Japanese translation (diff)
downloadapache2-68b56009d5c0a581a1d472c09647597e2ddb5a47.tar.xz
apache2-68b56009d5c0a581a1d472c09647597e2ddb5a47.zip
Fix computation of the size of 'struct sockaddr_un' when passed to 'connect()'.
Use the same logic as the one in ' in 'proxy_util.c'. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1598946 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/proxy/mod_proxy_fdpass.c')
-rw-r--r--modules/proxy/mod_proxy_fdpass.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/proxy/mod_proxy_fdpass.c b/modules/proxy/mod_proxy_fdpass.c
index 26a7b13e53..1e52d677a2 100644
--- a/modules/proxy/mod_proxy_fdpass.c
+++ b/modules/proxy/mod_proxy_fdpass.c
@@ -55,6 +55,7 @@ static int proxy_fdpass_canon(request_rec *r, char *url)
}
/* TODO: In APR 2.x: Extend apr_sockaddr_t to possibly be a path !!! */
+/* XXX: The same function exists in proxy_util.c */
static apr_status_t socket_connect_un(apr_socket_t *sock,
struct sockaddr_un *sa)
{
@@ -73,8 +74,9 @@ static apr_status_t socket_connect_un(apr_socket_t *sock,
}
do {
- rv = connect(rawsock, (struct sockaddr*)sa,
- sizeof(*sa) + strlen(sa->sun_path));
+ const socklen_t addrlen = APR_OFFSETOF(struct sockaddr_un, sun_path)
+ + strlen(sa->sun_path) + 1;
+ rv = connect(rawsock, (struct sockaddr*)sa, addrlen);
} while (rv == -1 && errno == EINTR);
if ((rv == -1) && (errno == EINPROGRESS || errno == EALREADY)