[CRIU] [PATCH 4/4] fix: Missing check at restore with --remote option

Katerina Koukiou k.koukiou at googlemail.com
Tue Aug 2 09:39:40 PDT 2016


When running "criu restore --remote etc", if we have forgotten
to set local-cache-path argument, we are getting a SIGSEV
because of missing checks.

Signed-off-by: Katerina Koukiou <k.koukiou at gmail.com>
---
 criu/img-remote-proto.c | 4 ++++
 criu/img-remote.c       | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/criu/img-remote-proto.c b/criu/img-remote-proto.c
index d8fd8cd..c95613c 100644
--- a/criu/img-remote-proto.c
+++ b/criu/img-remote-proto.c
@@ -265,6 +265,10 @@ int setup_UNIX_server_socket(char *path)
 
 int setup_UNIX_client_socket(char *path)
 {
+	if (!path) {
+		pr_err("Path should not be empty\n");
+		return -1;
+	}
 	struct sockaddr_un addr;
 	int sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
 
diff --git a/criu/img-remote.c b/criu/img-remote.c
index 05f3666..c621e31 100644
--- a/criu/img-remote.c
+++ b/criu/img-remote.c
@@ -55,6 +55,9 @@ static char *get_local_img_path(void)
 		local_img_path = opts.local_cache_path;
 	else if (strcmp(opts.local_proxy_path, DEFAULT_IMG_PATH))
 		local_img_path = opts.local_proxy_path;
+	else
+		pr_err("Local img path is missing. Possible missing "
+				"--local-{cache,proxy}-cache option\n");
 
 	return local_img_path;
 }
-- 
2.7.3



More information about the CRIU mailing list