From 64a7aa55eb7acc1d1622eddd4800524ce733d5ed Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Tue, 16 Sep 2014 16:03:00 +0400 Subject: [PATCH] cg: Fix separator search in parse_task_cgroup If there is no separator in first place we should avoid implicit + 1 which make @name = 1 in worst case. Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- proc_parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proc_parse.c b/proc_parse.c index e311f40a4..1d9bc7b72 100644 --- a/proc_parse.c +++ b/proc_parse.c @@ -1706,9 +1706,9 @@ int parse_task_cgroup(int pid, struct list_head *retl, unsigned int *n) * 3:cpuset:/ * 2:name=systemd:/user.slice/user-1000.slice/session-1.scope */ - name = strchr(buf, ':') + 1; + name = strchr(buf, ':'); if (name) - path = strchr(name, ':'); + path = strchr(++name, ':'); if (!name || !path) { pr_err("Failed parsing cgroup %s\n", buf); xfree(ncc);