2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-02 07:15:31 +00:00

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 <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov
2014-09-16 16:03:00 +04:00
committed by Pavel Emelyanov
parent fc983814cc
commit 64a7aa55eb

View File

@@ -1706,9 +1706,9 @@ int parse_task_cgroup(int pid, struct list_head *retl, unsigned int *n)
* 3:cpuset:/ * 3:cpuset:/
* 2:name=systemd:/user.slice/user-1000.slice/session-1.scope * 2:name=systemd:/user.slice/user-1000.slice/session-1.scope
*/ */
name = strchr(buf, ':') + 1; name = strchr(buf, ':');
if (name) if (name)
path = strchr(name, ':'); path = strchr(++name, ':');
if (!name || !path) { if (!name || !path) {
pr_err("Failed parsing cgroup %s\n", buf); pr_err("Failed parsing cgroup %s\n", buf);
xfree(ncc); xfree(ncc);