mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 06:45:35 +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:
committed by
Andrei Vagin
parent
f44939317f
commit
b47ef26eac
@@ -590,12 +590,12 @@ static int collect_cgroups(struct list_head *ctls)
|
|||||||
if (opts.cgroup_yard) {
|
if (opts.cgroup_yard) {
|
||||||
char dir_path[PATH_MAX];
|
char dir_path[PATH_MAX];
|
||||||
int off;
|
int off;
|
||||||
|
|
||||||
off = snprintf(dir_path, PATH_MAX, "%s/", opts.cgroup_yard);
|
off = snprintf(dir_path, PATH_MAX, "%s/", opts.cgroup_yard);
|
||||||
if (strstartswith(cc->name, namestr))
|
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
|
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);
|
fd = open(dir_path, O_RDONLY | O_DIRECTORY, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
Reference in New Issue
Block a user