chiark / gitweb /
Use strlen even for constant strings
[elogind.git] / src / shared / cgroup-util.c
index 06eb453d1a131be358ebdadbbad1477781deb014..9d50890adc22047cfae1db4cb957a68c5b663d22 100644 (file)
@@ -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;