binutils: support for the SPARC M8 processor
[deliverable/binutils-gdb.git] / binutils / ar.c
index 1337710d20efb7482fcdc4c94d58fe3cfff9c1ea..ef8b5bdb12bede18c47f65e2615b9e0ade8f9a56 100644 (file)
@@ -1,5 +1,5 @@
 /* ar.c - Archive modify and extract.
-   Copyright (C) 1991-2016 Free Software Foundation, Inc.
+   Copyright (C) 1991-2017 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -33,6 +33,7 @@
 #include "arsup.h"
 #include "filenames.h"
 #include "binemul.h"
+#include "plugin-api.h"
 #include "plugin.h"
 
 #ifdef __GO32___
@@ -737,6 +738,9 @@ main (int argc, char **argv)
 
   arg_index = 0;
 
+  if (argv[arg_index] == NULL)
+    usage (0);
+
   if (mri_mode)
     {
       default_deterministic ();
@@ -775,18 +779,26 @@ main (int argc, char **argv)
       default_deterministic ();
 
       if (postype != pos_default)
-       posname = argv[arg_index++];
+       {
+         posname = argv[arg_index++];
+         if (posname == NULL)
+           fatal (_("missing position arg."));
+       }
 
       if (counted_name_mode)
        {
          if (operation != extract && operation != del)
            fatal (_("`N' is only meaningful with the `x' and `d' options."));
+         if (argv[arg_index] == NULL)
+           fatal (_("`N' missing value."));
          counted_name_counter = atoi (argv[arg_index++]);
          if (counted_name_counter <= 0)
            fatal (_("Value for `N' must be positive."));
        }
 
       inarch_filename = argv[arg_index++];
+      if (inarch_filename == NULL)
+       usage (0);
 
       for (file_count = 0; argv[arg_index + file_count] != NULL; file_count++)
        continue;
This page took 0.026285 seconds and 4 git commands to generate.