2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

cgroup: fixup nits

1) s/\s*$//
2) fix snprintf out of bound access

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
Pavel Tikhomirov
2019-09-21 13:35:18 +03:00
committed by Andrei Vagin
parent f44939317f
commit b47ef26eac

View File

@@ -590,12 +590,12 @@ static int collect_cgroups(struct list_head *ctls)
if (opts.cgroup_yard) {
char dir_path[PATH_MAX];
int off;
off = snprintf(dir_path, PATH_MAX, "%s/", opts.cgroup_yard);
if (strstartswith(cc->name, namestr))
snprintf(dir_path + off, PATH_MAX, "%s", cc->name + strlen(namestr));
snprintf(dir_path + off, PATH_MAX - off, "%s", cc->name + strlen(namestr));
else
snprintf(dir_path + off, PATH_MAX, "%s", cc->name);
snprintf(dir_path + off, PATH_MAX - off, "%s", cc->name);
fd = open(dir_path, O_RDONLY | O_DIRECTORY, 0);
if (fd < 0) {