forked from lix-project/lix
strcpy -> memcpy
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
This commit is contained in:
parent
c24b9d68c5
commit
dced45f146
|
@ -1715,7 +1715,7 @@ void bind(int fd, const std::string & path)
|
||||||
std::string base(baseNameOf(path));
|
std::string base(baseNameOf(path));
|
||||||
if (base.size() + 1 >= sizeof(addr.sun_path))
|
if (base.size() + 1 >= sizeof(addr.sun_path))
|
||||||
throw Error("socket path '%s' is too long", base);
|
throw Error("socket path '%s' is too long", base);
|
||||||
strcpy(addr.sun_path, base.c_str());
|
memcpy(addr.sun_path, base.c_str(), base.size() + 1);
|
||||||
if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
||||||
throw SysError("cannot bind to socket '%s'", path);
|
throw SysError("cannot bind to socket '%s'", path);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
|
@ -1724,7 +1724,7 @@ void bind(int fd, const std::string & path)
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
throw Error("cannot bind to socket '%s'", path);
|
throw Error("cannot bind to socket '%s'", path);
|
||||||
} else {
|
} else {
|
||||||
strcpy(addr.sun_path, path.c_str());
|
memcpy(addr.sun_path, path.c_str(), path.size() + 1);
|
||||||
if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
||||||
throw SysError("cannot bind to socket '%s'", path);
|
throw SysError("cannot bind to socket '%s'", path);
|
||||||
}
|
}
|
||||||
|
@ -1744,7 +1744,7 @@ void connect(int fd, const std::string & path)
|
||||||
std::string base(baseNameOf(path));
|
std::string base(baseNameOf(path));
|
||||||
if (base.size() + 1 >= sizeof(addr.sun_path))
|
if (base.size() + 1 >= sizeof(addr.sun_path))
|
||||||
throw Error("socket path '%s' is too long", base);
|
throw Error("socket path '%s' is too long", base);
|
||||||
strcpy(addr.sun_path, base.c_str());
|
memcpy(addr.sun_path, base.c_str(), base.size() + 1);
|
||||||
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
||||||
throw SysError("cannot connect to socket at '%s'", path);
|
throw SysError("cannot connect to socket at '%s'", path);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
|
@ -1753,7 +1753,7 @@ void connect(int fd, const std::string & path)
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
throw Error("cannot connect to socket at '%s'", path);
|
throw Error("cannot connect to socket at '%s'", path);
|
||||||
} else {
|
} else {
|
||||||
strcpy(addr.sun_path, path.c_str());
|
memcpy(addr.sun_path, path.c_str(), path.size() + 1);
|
||||||
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
||||||
throw SysError("cannot connect to socket at '%s'", path);
|
throw SysError("cannot connect to socket at '%s'", path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue