[CRIU] [PATCH 1/2] service: ban subdirs in logfile name

Ruslan Kuprieiev kupruser at gmail.com
Tue Feb 4 00:51:12 PST 2014


Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 cr-service.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/cr-service.c b/cr-service.c
index ff2fb0d..5ef5d52 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -189,9 +189,14 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 	}
 
 	/* initiate log file in work dir */
-	if (req->log_file)
+	if (req->log_file) {
+		if (strchr(req->log_file, '.') || strchr(req->log_file, '/')) {
+			pr_perror("No subdirs are allowed in log_file name");
+			return -1;
+		}
+
 		opts.output = req->log_file;
-	else
+	} else
 		opts.output = DEFAULT_LOG_FILENAME;
 
 	log_set_loglevel(req->log_level);
-- 
1.8.3.2



More information about the CRIU mailing list