[CRIU] [PATCH] crtools: Fix potential nil dereference

Cyrill Gorcunov gorcunov at openvz.org
Mon Sep 14 07:08:40 PDT 2015


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 crtools.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crtools.c b/crtools.c
index ac74c106da97..f10e5c00126a 100644
--- a/crtools.c
+++ b/crtools.c
@@ -551,6 +551,8 @@ int main(int argc, char *argv[], char *envp[])
 		}
 
 		opts.exec_cmd = xmalloc((argc - optind) * sizeof(char *));
+		if (!opts.exec_cmd)
+			return 1;
 		memcpy(opts.exec_cmd, &argv[optind + 1], (argc - optind - 1) * sizeof(char *));
 		opts.exec_cmd[argc - optind - 1] = NULL;
 	} else if (optind + 1 != argc) {
-- 
2.4.3



More information about the CRIU mailing list