From f11a6fba99b44b9ab1a5e03a8c90aa52e68478ce Mon Sep 17 00:00:00 2001 From: Alexander Vershilov <alexander.vershilov@gmail.com> Date: Sun, 8 Sep 2019 14:11:47 +0200 Subject: [PATCH] Pass sizeof(socket) lenght to bind function. --- stub/cbits/stub.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stub/cbits/stub.cpp b/stub/cbits/stub.cpp index e99691d0..1decbd7f 100644 --- a/stub/cbits/stub.cpp +++ b/stub/cbits/stub.cpp @@ -511,8 +511,7 @@ void serve(void) { if (sock == NULL){ sock = "/tmp/ghc-debug"; } strcpy(local.sun_path, sock); unlink(local.sun_path); - int len = strlen(local.sun_path) + sizeof(local.sun_family); - if (bind(s, (struct sockaddr *) &local, len) != 0) { + if (bind(s, (struct sockaddr *) &local, sizeof(local)) != 0) { barf("bind failed"); } } -- GitLab