mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
core: prevent invalid socket symlink target dereference (#4895)
socket_find_symlink_target() returns a pointer to p->address.sockaddr.un.sun_path when the first byte is non-zero without checking that this is AF_UNIX socket. Since sockaddr is a union this byte could be non-zero for AF_INET sockets. Existing callers happen to be safe but is an accident waiting to happen. Use socket_address_get_path() since it checks for AF_UNIX.
This commit is contained in:
parent
d84071d569
commit
b9495e8d58
@ -423,8 +423,7 @@ static const char *socket_find_symlink_target(Socket *s) {
|
||||
break;
|
||||
|
||||
case SOCKET_SOCKET:
|
||||
if (p->address.sockaddr.un.sun_path[0] != 0)
|
||||
f = p->address.sockaddr.un.sun_path;
|
||||
f = socket_address_get_path(&p->address);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user