[binutils-gdb/users/hjl/linux/master] Fixes a buffer overflow when compiling assembler for the MinGW targets.

H.J.Lu hjl@sourceware.org
Sun Jan 11 16:20:00 GMT 2015


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

commit 60ebc25751744f54ae5c00d1c9198ab64fcc5b33
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Jan 6 16:46:40 2015 +0000

    Fixes a buffer overflow when compiling assembler for the MinGW targets.
    
    	PR binutils/17754
    	* internal.h (internal_auxent): Increase size of x_fname field to
    	20 to allow for PE format's longer file names.

Diff:
---
 include/coff/ChangeLog  | 6 ++++++
 include/coff/internal.h | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog
index 343298f..232e4fc 100644
--- a/include/coff/ChangeLog
+++ b/include/coff/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-06  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/17754
+	* internal.h (internal_auxent): Increase size of x_fname field to
+	20 to allow for PE format's longer file names.
+
 2015-01-01  Alan Modra  <amodra@gmail.com>
 
 	Update year range in copyright notice of all files.
diff --git a/include/coff/internal.h b/include/coff/internal.h
index 8329564..c4f24bb 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -588,7 +588,11 @@ union internal_auxent
 
   union
   {
-    char x_fname[FILNMLEN];
+    /* PR 17754: We use to FILNMLEN for the size of the x_fname
+       array, but that cause problems as PE targets use a larger
+       value.  We cannot use their definition of EFILNMLEN as this
+       header can be used without including any PE headers.  */
+    char x_fname[20];
     struct
     {
       long x_zeroes;



More information about the Binutils-cvs mailing list