1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-21 02:50:18 +03:00

sd-daemon: verify NOTIFY_SOCKET path length

Better generate a real error then simply connect to the wrong socket.
This commit is contained in:
Lennart Poettering 2015-11-01 21:49:19 +01:00
parent a47806fafa
commit 638b56cd3c

View File

@ -436,6 +436,11 @@ _public_ int sd_pid_notify_with_fds(pid_t pid, int unset_environment, const char
goto finish;
}
if (strlen(e) > sizeof(sockaddr.un.sun_path)) {
r = -EINVAL;
goto finish;
}
fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0) {
r = -errno;