[network] fix compile break in calculation of sockaddr_un size if SUN_LEN is not defined (fixes #2609)

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2972 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.36
Stefan Bühler 8 years ago
parent 76870cfef1
commit b0a632f253
  1. 1
      NEWS
  2. 13
      src/network.c

@ -12,6 +12,7 @@ NEWS
* [mod_dirlisting,mod_redirect,mod_rewrite] abort config parsing if pcre-compile fails or isn't available
* [ssl] disable SSL3.0 by default
* fixed typo in example config found by openSUSE user (boo# 907709)
* [network] fix compile break in calculation of sockaddr_un size if SUN_LEN is not defined (fixes #2609)
- 1.4.35 - 2014-03-12
* [network/ssl] fix build error if TLSEXT is disabled

@ -349,6 +349,8 @@ static int network_server_init(server *srv, buffer *host_token, specific_config
break;
case AF_UNIX:
memset(&srv_socket->addr, 0, sizeof(struct sockaddr_un));
srv_socket->addr.un.sun_family = AF_UNIX;
{
size_t hostlen = strlen(host) + 1;
if (hostlen > sizeof(srv_socket->addr.un.sun_path)) {
@ -356,15 +358,14 @@ static int network_server_init(server *srv, buffer *host_token, specific_config
goto error_free_socket;
}
memcpy(srv_socket->addr.un.sun_path, host, hostlen);
}
srv_socket->addr.un.sun_family = AF_UNIX;
#ifdef SUN_LEN
addr_len = SUN_LEN(&srv_socket->addr.un);
#if defined(SUN_LEN)
addr_len = SUN_LEN(&srv_socket->addr.un);
#else
/* stevens says: */
addr_len = hostlen + sizeof(srv_socket->addr.un.sun_family);
/* stevens says: */
addr_len = hostlen + sizeof(srv_socket->addr.un.sun_family);
#endif
}
/* check if the socket exists and try to connect to it. */
if (-1 != (fd = connect(srv_socket->fd, (struct sockaddr *) &(srv_socket->addr), addr_len))) {

Loading…
Cancel
Save