From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu Zhiguo Subject: [PATCH] tools/xenconsole: fix Segmentation fault Date: Mon, 08 Feb 2010 14:47:48 +0800 Message-ID: <4B6FB394.9040803@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Segmentation fault occurs if DOMID isn't specified. Some check be added to output error message in this situation. Signed-off-by: Yu Zhiguo diff -r 7b751b0e6f1b -r 22dfbd21b44e tools/console/client/main.c --- a/tools/console/client/main.c Thu Feb 04 19:40:19 2010 +0000 +++ b/tools/console/client/main.c Mon Feb 08 11:31:06 2010 +0800 @@ -287,7 +287,13 @@ exit(EINVAL); } } - + + if (optind >= argc) { + fprintf(stderr, "DOMID should be specified\n"); + fprintf(stderr, "Try `%s --help' for more information.\n", + argv[0]); + exit(EINVAL); + } domid = strtol(argv[optind], &end, 10); if (end && *end) { fprintf(stderr, "Invalid DOMID `%s'\n", argv[optind]);