mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
get_image_path: calculate size of string correctly
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
committed by
Cyrill Gorcunov
parent
4ba93d0806
commit
b84babe630
@@ -239,9 +239,11 @@ int get_image_path(char *path, int size, const char *fmt, int pid)
|
||||
|
||||
strcpy(path, image_dir);
|
||||
path[image_dir_size] = '/';
|
||||
size -= image_dir_size + 1;
|
||||
|
||||
ret = snprintf(path + image_dir_size + 1, size, fmt, pid);
|
||||
if (ret == -1 || ret > size) {
|
||||
pr_err("can't get image path");
|
||||
if (ret == -1 || ret >= size) {
|
||||
pr_err("can't get image path\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user