From 60473f0c23674bbde9f1b3cf1a2222a89c254886 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 7 Dec 2018 16:22:10 +0100 Subject: [PATCH] pid1: fix (harmless) off-by-one in PATH_MAX comparison 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/manager.c b/src/core/manager.c index 871047e6281..2398dcf4eae 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -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); -- 2.47.3