Commit 64a7aa55 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

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: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent fc983814
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment