]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
api: allocate correct value size to copy value provided to cgroup_set_value_string
authorJustin Israel <justinisrael@gmail.com>
Thu, 23 Feb 2023 22:53:17 +0000 (11:53 +1300)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 24 Feb 2023 15:31:42 +0000 (08:31 -0700)
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit b90efb3e2d7741e16bebee9774453346f45ba258)

src/wrapper.c

index 8625fddf2616949dc31b20624dcd89ab8b3d2eb0..c97b529ea5fabbc2446c1aaed4f0596484e45fd2 100644 (file)
@@ -469,7 +469,7 @@ int cgroup_set_value_string(struct cgroup_controller *controller, const char *na
                struct control_value *val = controller->values[i];
 
                if (!strcmp(val->name, name)) {
-                       strncpy(val->value, value, CG_VALUE_MAX);
+                       strncpy(val->value, value, CG_CONTROL_VALUE_MAX);
                        val->value[sizeof(val->value)-1] = '\0';
                        val->dirty = true;
                        return 0;