This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix microblaze-elf sprintf buffer overflow
- From: Jeff Law <law at redhat dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 24 Jan 2017 08:51:15 -0700
- Subject: Fix microblaze-elf sprintf buffer overflow
- Authentication-results: sourceware.org; auth=none
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.