This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Fix microblaze-elf sprintf buffer overflow



This was found building config-list.mk last night using the trunk compiler. The buffer can clearly overflow for large label numbers.

Confirmed that the microblaze target builds, and installed.

Jeff
commit 5b9382fcd400c8587667d7125f240ebec4ae2c81
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Jan 24 15:49:32 2017 +0000

    	* config/microblaze/microblaze.h (ASM_FORMAT_PRIVATE_NAME): Increase
    	buffer size.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244877 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f21bd83..1deec60 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-24 Jeff Law  <law@redhat.com>
+
+	* config/microblaze/microblaze.h (ASM_FORMAT_PRIVATE_NAME): Increase
+	buffer size.
+
 2017-01-24  Bin Cheng  <bin.cheng@arm.com>
 
 	PR tree-optimization/79159
diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
index 8fdadbf..66e4ef5 100644
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -757,7 +757,7 @@ do {									\
    an assembler-name for a local static variable named NAME.
    LABELNO is an integer which is different for each call.  */
 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)			\
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),			\
+( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 13),			\
   sprintf ((OUTPUT), "%s.%lu", (NAME), (unsigned long)(LABELNO)))
 
 /* How to start an assembler comment.

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