2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 05:18:00 +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:/
* 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);