]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pid1: fix (harmless) off-by-one in PATH_MAX comparison
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 7 Dec 2018 15:22:10 +0000 (16:22 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 10 Dec 2018 10:57:26 +0000 (11:57 +0100)
PATH_MAX is supposed to include the terminating NUL byte. But we already
check that there is no NUL byte in the specified path. Hence the maximum
length we can expect is PATH_MAX - 1.

This doesn't change much, but makes this use of PATH_MAX consistent with the
rest of the codebase.

src/core/manager.c

index 871047e62816fb00f9924bb47fd3c0b83094c23e..2398dcf4eaea5dbe837b903758c5ee5c1057b1f1 100644 (file)
@@ -2222,7 +2222,7 @@ static unsigned manager_dispatch_dbus_queue(Manager *m) {
 
 static int manager_dispatch_cgroups_agent_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
         Manager *m = userdata;
-        char buf[PATH_MAX+1];
+        char buf[PATH_MAX];
         ssize_t n;
 
         n = recv(fd, buf, sizeof(buf), 0);