From 05d32ae0e0dceefa26a98e5dc9ba3665c27be765 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Wed, 28 Oct 1992 21:20:57 +0000 Subject: [PATCH] (process_command): Check that we have enough arguments. From-SVN: r2636 --- gcc/gcc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/gcc.c b/gcc/gcc.c index f1cf450865c..74e53b4faad 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -2197,6 +2197,8 @@ process_command (argc, argv) /* Count only the option arguments in separate argv elements. */ n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0); } + if (i + n_args >= argc) + fatal ("argument to `-%s' is missing", p); switches[n_switches].args = (char **) xmalloc ((n_args + 1) * sizeof (char *)); while (j < n_args) -- 2.30.2