about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-09-02 12:56:50 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-09-02 15:36:52 +0200
commit326e288b1e43832c138e5eb4521157d8aacef5b7 (patch)
tree4662ba87d63dfd1cac9e2543f1afcf9aecc7ca46
parent2bad840e9d4b3e714b4f20ad6b46a76e7be1d8fe (diff)
downloadglibc-326e288b1e43832c138e5eb4521157d8aacef5b7.tar.gz
glibc-326e288b1e43832c138e5eb4521157d8aacef5b7.tar.xz
glibc-326e288b1e43832c138e5eb4521157d8aacef5b7.zip
vfprintf: Avoid creating a VLA which complicates stack management
-rw-r--r--ChangeLog5
-rw-r--r--stdio-common/vfprintf.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fa9394d6b3..ef10db070b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-09-02  Florian Weimer  <fweimer@redhat.com>
+
+	* stdio-common/vfprintf.c (process_string_arg): Use MB_LEN_MAX
+	instead of MB_CUR_MAX to avoid variable-length array.
+
 2016-09-01  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
 	* math/Makefile (libm-calls): Remove k_rem_pio2F.
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 6e428e9044..13ab47a4c2 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1082,7 +1082,7 @@ static const uint8_t jump_table[] =
     LABEL (form_wcharacter):						      \
       {									      \
 	/* Wide character.  */						      \
-	char buf[MB_CUR_MAX];						      \
+	char buf[MB_LEN_MAX];						      \
 	mbstate_t mbstate;						      \
 	size_t len;							      \
 									      \