From: Christophe Jaillet Date: Sun, 1 Jun 2014 06:54:15 +0000 (+0000) Subject: Fix computation of the size of 'struct sockaddr_un' when passed to 'connect()'. X-Git-Tag: 2.5.0-alpha~4128 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=68b56009d5c0a581a1d472c09647597e2ddb5a47;p=apache 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 --- diff --git a/CHANGES b/CHANGES index 841309b746..f49bdf973e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_proxy_fdpass: Fix computation of the size of 'struct sockaddr_un' + when passed to 'connec()'. + [Graham Dumpleton ] + *) mod_socache_shmcb: Correct counting of expirations for status display. Expirations happening during retrieval were not counted. [Rainer Jung] 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)