]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-daemon: verify NOTIFY_SOCKET path length
authorLennart Poettering <lennart@poettering.net>
Sun, 1 Nov 2015 20:49:19 +0000 (21:49 +0100)
committerLennart Poettering <lennart@poettering.net>
Sun, 1 Nov 2015 20:49:19 +0000 (21:49 +0100)
Better generate a real error then simply connect to the wrong socket.

src/libsystemd/sd-daemon/sd-daemon.c

index c7887804df43a720de8e3d24bdfe99d17ecf0b37..27045e25d0c583a1131ddfdf95b6b1d9e0d0ece1 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;