chiark / gitweb /
sd-daemon: verify NOTIFY_SOCKET path length
authorLennart Poettering <lennart@poettering.net>
Sun, 1 Nov 2015 20:49:19 +0000 (21:49 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 26 Apr 2017 10:58:55 +0000 (12:58 +0200)
src/libelogind/sd-daemon/sd-daemon.c

index e10444f498eae0efa71bb8a37e9642b704cc0b64..172409b73a3b7e4d04b9edfbfb4358badf610bd9 100644 (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;