This is the mail archive of the binutils-cvs@sourceware.org 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]
Other format: [Raw text]

[binutils-gdb] PR 21417, ar arg check failure


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7034215fd6d99f275998f7f0f8a346ab35fcbee6

commit 7034215fd6d99f275998f7f0f8a346ab35fcbee6
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Apr 23 17:28:14 2017 +0930

    PR 21417, ar arg check failure
    
    	PR 21417
    	* ar.c (main): Check that an archive file is given after options.

Diff:
---
 binutils/ChangeLog | 5 +++++
 binutils/ar.c      | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 735a344..13a665c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,10 @@
 2017-04-23  Alan Modra  <amodra@gmail.com>
 
+	PR 21417
+	* ar.c (main): Check that an archive file is given after options.
+
+2017-04-23  Alan Modra  <amodra@gmail.com>
+
 	PR 21415
 	* objdump.c (disassemble_section): Check bfd_get_section_contents
 	status.
diff --git a/binutils/ar.c b/binutils/ar.c
index 274be46..8e4d81c 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -788,6 +788,8 @@ main (int argc, char **argv)
 	}
 
       inarch_filename = argv[arg_index++];
+      if (inarch_filename == NULL)
+	usage (0);
 
       for (file_count = 0; argv[arg_index + file_count] != NULL; file_count++)
 	continue;


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