Check for buffer overflow when constructing the socket path.
This commit is contained in:
parent
9e6b678cf7
commit
9cf8a3ccd6
|
@ -614,7 +614,10 @@ static sockaddr_un session_addr(StringView session)
|
||||||
{
|
{
|
||||||
sockaddr_un addr;
|
sockaddr_un addr;
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
strcpy(addr.sun_path, session_path(session).c_str());
|
String path = session_path(session);
|
||||||
|
if (path.length() + 1 > sizeof addr.sun_path)
|
||||||
|
throw runtime_error{format("socket path too long: '{}'", path)};
|
||||||
|
strcpy(addr.sun_path, path.c_str());
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user