summaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-05-10 06:44:30 +0000
committerJakub Jelinek <jakub@redhat.com>2007-05-10 06:44:30 +0000
commit96bad006f14ac46ca7a59dc4c5ba5ed9ef7a1560 (patch)
tree9e209798f73466fb9622bf0a9b14f4fabf00eb29 /stdio-common
parent2a0a747e57ec96bab9d4a6b7c0b32df82a41316e (diff)
Updated to fedora-glibc-20070510T0634cvs/fedora-glibc-2_5_90-23
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/vfprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 4f0d971c55..20638ad1fd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1026,10 +1026,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
const char *mbs = (const char *) string; \
mbstate_t mbstate; \
\
- len = prec != -1 ? (size_t) prec : strlen (mbs); \
+ len = prec != -1 ? __strnlen (mbs, (size_t) prec) : strlen (mbs); \
\
/* Allocate dynamically an array which definitely is long \
- enough for the wide character version. */ \
+ enough for the wide character version. Each byte in the \
+ multi-byte string can produce at most one wide character. */ \
if (__libc_use_alloca (len * sizeof (wchar_t))) \
string = (CHAR_T *) alloca (len * sizeof (wchar_t)); \
else if ((string = (CHAR_T *) malloc (len * sizeof (wchar_t))) \