moonbridge
changeset 309:426848ae6108
Bugfix: Properly set sun_len, sun_family, and addrlen when filling sockaddr_un struct (using maximum possible length)
author | jbe |
---|---|
date | Fri Nov 24 01:32:23 2017 +0100 (2017-11-24) |
parents | 7751e4982916 |
children | 2807fdd2f8d5 930a43a0099a |
files | moonbridge.c |
line diff
1.1 --- a/moonbridge.c Fri Nov 24 00:44:04 2017 +0100 1.2 +++ b/moonbridge.c Fri Nov 24 01:32:23 2017 +0100 1.3 @@ -1972,7 +1972,10 @@ 1.4 if (strlen(path) > path_maxlen) { 1.5 luaL_error(L, "Path name for local socket exceeded maximum length of %i characters", path_maxlen); 1.6 } 1.7 + listener->type_specific.socket.addr.addr_un.sun_len = sizeof(listener->type_specific.socket.addr.addr_un); 1.8 + listener->type_specific.socket.addr.addr_un.sun_family = AF_LOCAL; 1.9 strcpy(listener->type_specific.socket.addr.addr_un.sun_path, path); 1.10 + listener->type_specific.socket.addrlen = sizeof(listener->type_specific.socket.addr.addr_un); 1.11 } else if (proto && !strcmp(proto, "tcp")) { 1.12 const char *host, *port; 1.13 struct addrinfo hints = { 0, };