From: Ivana Hutarova Varekova Date: Thu, 9 May 2013 11:51:19 +0000 (+0200) Subject: api.c: cgroup_create_template_group templates crashing X-Git-Tag: v0.41~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61999fbd9e4613b87b99b1265ce2528e9844ce6c;p=thirdparty%2Flibcgroup.git api.c: cgroup_create_template_group templates crashing 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 Acked-By: Jan Safranek --- diff --git a/src/api.c b/src/api.c index 4057945e..ee18797b 100644 --- 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: