bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Properly guard against a call without parameters.


From: Pascal Obry
Subject: [PATCH] Properly guard against a call without parameters.
Date: Wed, 24 Sep 2008 11:50:46 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.0

Calling windres without parameter was crashing (segmentation
violation). We properly check the number of argument, if none
the usage string is displayed.
---
 binutils/ChangeLog |    7 +++++++
 binutils/windres.c |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git binutils/ChangeLog binutils/ChangeLog
index 4394743..5b8c38e 100644
--- binutils/ChangeLog
+++ binutils/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-20  Pascal Obry  <address@hidden>
+
+       binutils/
+       * windres.c (main): Ensure that windres won't crash when
+       no parameter passed on the command line. In this case
+       we display the usage string.
+
 2007-08-28  Nick Clifton  <address@hidden>

        * NEWS: Mention Coverity's contribution.
diff --git binutils/windres.c binutils/windres.c
index ac643ad..4574222 100644
--- binutils/windres.c
+++ binutils/windres.c
@@ -989,7 +989,7 @@ main (int argc, char **argv)
       ++optind;
     }

-  if (argc != optind)
+  if (argc != optind || argc == 1)
     usage (stderr, 1);

   if (input_format == RES_FORMAT_UNKNOWN)
--
1.6.0.2.307.gc4275

-- 
  Pascal Obry
  --
  gpg --keyserver wwwkeys.pgp.net --recv-key C1082595





reply via email to

[Prev in Thread] Current Thread [Next in Thread]