aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Unrau <runrau@cygnus>1998-03-01 14:49:50 +0000
committerRon Unrau <runrau@cygnus>1998-03-01 14:49:50 +0000
commitaac9328044befd167030b1ec2974e1f99d665581 (patch)
tree160df284ac0eb2453ee1c960ae2fc437d17ceed4
parentaaab4e578d6b6ebdfdf63ec25e012ffde264d800 (diff)
downloadbinutils-aac9328044befd167030b1ec2974e1f99d665581.zip
binutils-aac9328044befd167030b1ec2974e1f99d665581.tar.gz
binutils-aac9328044befd167030b1ec2974e1f99d665581.tar.bz2
(find_match): recheck argv[argi] in multi-word match. Fixes crash when
subset words are alone on the command line.
-rw-r--r--sim/common/sim-options.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index e94f9aa..01d1a7e 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] == '-')