diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-11-01 21:49:19 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-11-01 21:49:19 +0100 |
commit | 638b56cd3c703651013033b82000d2a9f2732048 (patch) | |
tree | 700e985b06b7b1095a2be7f9d62a674333a76fd7 /src/libsystemd/sd-daemon | |
parent | a47806fafaec9a52a80e1795ad880b9b5008c4b8 (diff) |
sd-daemon: verify NOTIFY_SOCKET path length
Better generate a real error then simply connect to the wrong socket.
Diffstat (limited to 'src/libsystemd/sd-daemon')
-rw-r--r-- | src/libsystemd/sd-daemon/sd-daemon.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c index c7887804df..27045e25d0 100644 --- a/src/libsystemd/sd-daemon/sd-daemon.c +++ b/src/libsystemd/sd-daemon/sd-daemon.c @@ -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; |