diff --git a/lib/core-net/network.c b/lib/core-net/network.c index 99e561995..e087cd100 100644 --- a/lib/core-net/network.c +++ b/lib/core-net/network.c @@ -215,7 +215,6 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port, #if defined(LWS_WITH_UNIX_SOCK) if (!port && LWS_UNIX_SOCK_ENABLED(vhost)) { v = (struct sockaddr *)&serv_unix; - n = sizeof(struct sockaddr_un); memset(&serv_unix, 0, sizeof(serv_unix)); serv_unix.sun_family = AF_UNIX; if (!iface) @@ -225,12 +224,15 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port, iface); return LWS_ITOSA_NOT_EXIST; } + n = sizeof(uint16_t) + strlen(iface); strcpy(serv_unix.sun_path, iface); if (serv_unix.sun_path[0] == '@') serv_unix.sun_path[0] = '\0'; else unlink(serv_unix.sun_path); + // lwsl_hexdump_notice(v, n); + } else #endif #if defined(LWS_WITH_IPV6) && !defined(LWS_PLAT_FREERTOS) diff --git a/lib/roles/http/client/client-handshake.c b/lib/roles/http/client/client-handshake.c index fcc1ecf8c..f1f525cda 100644 --- a/lib/roles/http/client/client-handshake.c +++ b/lib/roles/http/client/client-handshake.c @@ -684,7 +684,10 @@ ads_known: #if defined(LWS_WITH_UNIX_SOCK) if (wsi->unix_skt) { psa = (const struct sockaddr *)&sau; - n = sizeof(sau); + if (sau.sun_path[0]) + n = sizeof(uint16_t) + strlen(sau.sun_path); + else + n = sizeof(uint16_t) + strlen(&sau.sun_path[1]) + 1; } else #endif