[CRIU] [PATCH] crtools: check optind is valid before parsing command argument

Kinsbursky Stanislav skinsbursky at openvz.org
Thu Jul 26 07:33:58 EDT 2012


Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>

---
 crtools.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/crtools.c b/crtools.c
index 3987a87..36209cb 100644
--- a/crtools.c
+++ b/crtools.c
@@ -186,6 +186,9 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
+	if (optind >= argc)
+		goto usage;
+
 	if (strcmp(argv[optind], "dump") &&
 	    strcmp(argv[optind], "restore") &&
 	    strcmp(argv[optind], "show") &&



More information about the CRIU mailing list