diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/cgroup-util.c | 2 | ||||
-rw-r--r-- | src/shared/unit-name.c | 2 | ||||
-rw-r--r-- | src/shared/util.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index 06eb453d1a..9d50890adc 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -509,7 +509,7 @@ static int check_hierarchy(const char *p) { assert(p); /* Check if this controller actually really exists */ - cc = alloca(sizeof("/sys/fs/cgroup/") + strlen(p)); + cc = alloca(strlen("/sys/fs/cgroup/") + strlen(p) + 1); strcpy(stpcpy(cc, "/sys/fs/cgroup/"), p); if (access(cc, F_OK) < 0) return -errno; diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c index e9b0636143..6c167b4331 100644 --- a/src/shared/unit-name.c +++ b/src/shared/unit-name.c @@ -493,7 +493,7 @@ char *unit_name_mangle(const char *name, enum unit_name_mangle allow_globs) { /* We'll only escape the obvious characters here, to play * safe. */ - r = new(char, strlen(name) * 4 + 1 + sizeof(".service")-1); + r = new(char, strlen(name) * 4 + strlen(".service") + 1); if (!r) return NULL; diff --git a/src/shared/util.c b/src/shared/util.c index 7e17851fcd..75870fcbe2 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -4185,7 +4185,7 @@ int socket_from_display(const char *display, char **path) { k = strspn(display+1, "0123456789"); - f = new(char, sizeof("/tmp/.X11-unix/X") + k); + f = new(char, strlen("/tmp/.X11-unix/X") + k + 1); if (!f) return -ENOMEM; |