diff mbox

vfprintf: Avoid creating a VLA which complicates stack management

Message ID 20160902105723.8655D4019BD96@oldenburg.str.redhat.com
State New
Headers show

Commit Message

Florian Weimer Sept. 2, 2016, 10:57 a.m. UTC
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.

Comments

Andreas Schwab Sept. 2, 2016, 1:09 p.m. UTC | #1
On Sep 02 2016, fweimer@redhat.com (Florian Weimer) wrote:

> 	* stdio-common/vfprintf.c (process_string_arg): Use MB_LEN_MAX
> 	instead of MB_CUR_MAX to avoid variable-length array.

Ok.

Andreas.
diff mbox

Patch

diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 6e428e9..13ab47a 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;							      \
 									      \