]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
api.c: cgroup_create_template_group templates crashing
authorIvana Hutarova Varekova <varekova@redhat.com>
Thu, 9 May 2013 11:51:19 +0000 (13:51 +0200)
committerIvana Hutarova Varekova <varekova@redhat.com>
Thu, 9 May 2013 11:51:19 +0000 (13:51 +0200)
cgroup_create_template_group procedure writes to the first place of string of characters even if the varible points to NULL. As the result templates crashes.
See http://sourceforge.net/mailarchive/forum.php?thread_name=khtfkj%24c8l%241%40ger.gmane.org&forum_name=libcg-devel

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
src/api.c

index 4057945eec3fbf11dc490ba88e0ab9734524c0a0..ee18797bfe1f7265ed60b867ca2677b670055eb5 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -2843,9 +2843,9 @@ static int cgroup_create_template_group(char *orig_group_name,
        }
 
 while_end:
-       if (template_position[0] == '\0')
+       if ((template_position != NULL ) && (template_position[0] == '\0'))
                template_position[0] = '/';
-       if (group_position[0] == '\0')
+       if ((group_position != NULL) && (group_position[0] == '\0'))
                group_position[0] = '/';
 
 end: