This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] small fix for ar.c


Hi

ar.c from current CVS crashes when called without arguments because it
tries to do a strcmp on argv[1] which is NULL.

Jes

2000-08-10  Jes Sorensen  <jes@linuxcare.com>

	* ar.c (main): Only check for the -X32_64 option in argv[1+] if
	argc > 1 (strcmp does not like null pointers).

--- ar.c.old	Thu Aug 10 23:37:11 2000
+++ ar.c	Thu Aug 10 18:22:34 2000
@@ -437,10 +437,13 @@
      of object files in the archive (the 64-bit objects
      or the 32-bit objects).  GNU ar always looks at all
      kinds of objects in an archive.  */
-  while (strcmp (argv[1], "-X32_64") == 0)
+  if (argc > 1)
     {
-      argv++;
-      argc--;
+      while (strcmp (argv[1], "-X32_64") == 0)
+	{
+	  argv++;
+	  argc--;
+	}
     }
 
   if (is_ranlib)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]