Skip to content

Commit

Permalink
sd-daemon: verify NOTIFY_SOCKET path length
Browse files Browse the repository at this point in the history
Better generate a real error then simply connect to the wrong socket.
  • Loading branch information
poettering authored and ssahani committed Nov 3, 2015
1 parent 3038389 commit cb086d5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libsystemd/sd-daemon/sd-daemon.c
Expand Up @@ -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;
Expand Down

0 comments on commit cb086d5

Please sign in to comment.