* [Qemu-devel] [6580] Fix crash caused by missing command line arguments
@ 2009-02-09 19:02 Aurelien Jarno
0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2009-02-09 19:02 UTC (permalink / raw)
To: qemu-devel
Revision: 6580
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6580
Author: aurel32
Date: 2009-02-09 19:02:09 +0000 (Mon, 09 Feb 2009)
Log Message:
-----------
Fix crash caused by missing command line arguments
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Modified Paths:
--------------
trunk/linux-user/main.c
Modified: trunk/linux-user/main.c
===================================================================
--- trunk/linux-user/main.c 2009-02-09 18:28:36 UTC (rev 6579)
+++ trunk/linux-user/main.c 2009-02-09 19:02:09 UTC (rev 6580)
@@ -2301,6 +2301,8 @@
if (envlist_unsetenv(envlist, r) != 0)
usage();
} else if (!strcmp(r, "s")) {
+ if (optind >= argc)
+ break;
r = argv[optind++];
x86_stack_size = strtol(r, (char **)&r, 0);
if (x86_stack_size <= 0)
@@ -2312,6 +2314,8 @@
} else if (!strcmp(r, "L")) {
interp_prefix = argv[optind++];
} else if (!strcmp(r, "p")) {
+ if (optind >= argc)
+ break;
qemu_host_page_size = atoi(argv[optind++]);
if (qemu_host_page_size == 0 ||
(qemu_host_page_size & (qemu_host_page_size - 1)) != 0) {
@@ -2319,12 +2323,14 @@
exit(1);
}
} else if (!strcmp(r, "g")) {
+ if (optind >= argc)
+ break;
gdbstub_port = atoi(argv[optind++]);
} else if (!strcmp(r, "r")) {
qemu_uname_release = argv[optind++];
} else if (!strcmp(r, "cpu")) {
cpu_model = argv[optind++];
- if (strcmp(cpu_model, "?") == 0) {
+ if (cpu_model == NULL || strcmp(cpu_model, "?") == 0) {
/* XXX: implement xxx_cpu_list for targets that still miss it */
#if defined(cpu_list)
cpu_list(stdout, &fprintf);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-02-09 19:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-09 19:02 [Qemu-devel] [6580] Fix crash caused by missing command line arguments Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).