1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-21 18:05:33 +00:00

Pass correct sockaddr size to bind. (#178)

We should be passing the size of the `struct sockaddr_un`, not
the length of the path + the size of the path field.

There is another `bind` call in this file that had it right.
This commit is contained in:
Bruce Mitchener 2021-01-05 03:26:57 +07:00 committed by GitHub
parent 85aa360f2e
commit 226815dbd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -793,7 +793,7 @@ LispPTR Unix_handlecomm(LispPTR *args) {
sock.sun_family = AF_UNIX;
strcpy(sock.sun_path, shcom);
if (bind(sockFD, (struct sockaddr *)&sock, strlen(shcom) + sizeof(sock.sun_family)) < 0) {
if (bind(sockFD, (struct sockaddr *)&sock, sizeof(struct sockaddr_un)) < 0) {
close(sockFD);
free(UJ[sockFD].pathname);
UJ[sockFD].type = UJUNUSED;