2000-08-11 Kazu Hirata <kazu@hxi.com>
[deliverable/binutils-gdb.git] / gas / as.c
index f22120727ea4e19d97ba000a806b0a6b45761e29..644c898d7deae90b32593fc9ccbb919acad56cfc 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -117,6 +117,7 @@ static struct itbl_file_list *itbl_files;
 extern struct emulation mipsbelf, mipslelf, mipself;
 extern struct emulation mipsbecoff, mipslecoff, mipsecoff;
 extern struct emulation i386coff, i386elf, i386aout;
+extern struct emulation crisaout, criself;
 
 static struct emulation *const emulations[] = { EMULATIONS };
 static const int n_emulations = sizeof (emulations) / sizeof (emulations[0]);
@@ -425,13 +426,18 @@ parse_args (pargc, pargv)
     {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
   };
 
-  /* Construct the option lists from the standard list and the
-     target dependent list.  */
+  /* Construct the option lists from the standard list and the target
+     dependent list.  Include space for an extra NULL option and
+     always NULL terminate. */
   shortopts = concat (std_shortopts, md_shortopts, (char *) NULL);
-  longopts = (struct option *) xmalloc (sizeof (std_longopts) + md_longopts_size);
+  longopts = (struct option *) xmalloc (sizeof (std_longopts)
+                                       + md_longopts_size
+                                       + sizeof (struct option));
   memcpy (longopts, std_longopts, sizeof (std_longopts));
   memcpy ((char *) longopts + sizeof (std_longopts),
          md_longopts, md_longopts_size);
+  memset ((char *) longopts + sizeof (std_longopts) + md_longopts_size,
+         0, sizeof (struct option));
 
   /* Make a local copy of the old argv.  */
   old_argc = *pargc;
This page took 0.046576 seconds and 4 git commands to generate.