summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-06-25 00:33:59 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2019-06-25 00:39:24 -0400
commit186ce8a2b105cce1c8b5133f40b0b429e5547105 (patch)
tree7233cbcb70ca727a210495e5f8e22a7953a728e6
parentcc492d438b573764460a8c8c1a9d2c395984b7bb (diff)
downloadlighttpd1.4-master.tar.gz
lighttpd1.4-master.zip
[core] allocate unix socket paths with SUN_LEN()+1 (fixes #2962)HEADpersonal/gstrauss/mastermaster
(thx lighthouse2) x-ref: "SUN_LEN in sock_addr.c (1.4.53, 1.4.54)" https://redmine.lighttpd.net/issues/2962
-rw-r--r--src/sock_addr.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/sock_addr.c b/src/sock_addr.c
index cc15086c..7be57ce1 100644
--- a/src/sock_addr.c
+++ b/src/sock_addr.c
@@ -544,10 +544,9 @@ int sock_addr_from_str_hints(server *srv, sock_addr *saddr, socklen_t *len, cons
}
memcpy(saddr->un.sun_path, str, hostlen);
#if defined(SUN_LEN)
- *len = SUN_LEN(&saddr->un);
+ *len = SUN_LEN(&saddr->un)+1;
#else
- /* stevens says: */
- *len = hostlen + sizeof(saddr->un.sun_family);
+ *len = offsetof(struct sockaddr_un, sun_path) + hostlen;
#endif
}
return 1;