From aac9328044befd167030b1ec2974e1f99d665581 Mon Sep 17 00:00:00 2001 From: Ron Unrau Date: Sun, 1 Mar 1998 14:49:50 +0000 Subject: [PATCH] (find_match): recheck argv[argi] in multi-word match. Fixes crash when subset words are alone on the command line. --- sim/common/sim-options.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index e94f9aad43d..01d1a7e5b90 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -803,7 +803,8 @@ find_match (SIM_DESC sd, sim_cpu *cpu, char *argv[], int *pargi) const char *name = opt->opt.name; if (name == NULL) continue; - while (strncmp (name, argv [argi], strlen (argv [argi])) == 0) + while (argv [argi] != NULL + && strncmp (name, argv [argi], strlen (argv [argi])) == 0) { name = &name [strlen (argv[argi])]; if (name [0] == '-') -- 2.30.2