diff --git a/src/daemon/jdwp.cpp b/src/daemon/jdwp.cpp index 14675bdc55cdec8b87b90ff6bae6b39ad32f47af..313de510356991e3d8d864fa1bb05e8a4b6270d8 100644 --- a/src/daemon/jdwp.cpp +++ b/src/daemon/jdwp.cpp @@ -269,7 +269,8 @@ int HdcJdwp::UvPipeBind(uv_pipe_t* handle, const char* name, size_t size) } saddr.sun_path[capacity - 1] = '\0'; saddr.sun_family = AF_UNIX; - int err = bind(sockfd, reinterpret_cast(&saddr), sizeof saddr); + size_t saddrLen = sizeof(saddr.sun_family) + size - 1; + int err = bind(sockfd, reinterpret_cast(&saddr), saddrLen); if (err != 0) { strerror_r(errno, buffer, BUF_SIZE_DEFAULT); WRITE_LOG(LOG_FATAL, "bind failed errno:%d %s", errno, buffer);