mirror of
https://github.com/sogou/workflow.git
synced 2026-02-08 01:33:17 +08:00
fix unix domain socket path
This commit is contained in:
@@ -58,7 +58,7 @@ void DNSRoutine::run_local_path(const std::string& path, DNSOutput *out)
|
||||
{
|
||||
struct sockaddr_un *sun = NULL;
|
||||
|
||||
if (path.size() <= sizeof sun->sun_path)
|
||||
if (path.size() + 1 <= sizeof sun->sun_path)
|
||||
{
|
||||
size_t size = sizeof (struct addrinfo) + sizeof (struct sockaddr_un);
|
||||
|
||||
@@ -72,7 +72,7 @@ void DNSRoutine::run_local_path(const std::string& path, DNSOutput *out)
|
||||
out->addrinfo_->ai_family = AF_UNIX;
|
||||
out->addrinfo_->ai_socktype = SOCK_STREAM;
|
||||
out->addrinfo_->ai_addr = (struct sockaddr *)sun;
|
||||
size = offsetof(struct sockaddr_un, sun_path) + path.size();
|
||||
size = offsetof(struct sockaddr_un, sun_path) + path.size() + 1;
|
||||
out->addrinfo_->ai_addrlen = size;
|
||||
out->error_ = 0;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user