mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
[BZ #4438]
2007-04-30 Ulrich Drepper <drepper@redhat.com> [BZ #4438] * stdio-common/vfprintf.c (process_string_arg): Don't overflow the stack for large precisions.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2007-04-30 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
[BZ #4438]
|
||||||
|
* stdio-common/vfprintf.c (process_string_arg): Don't overflow the
|
||||||
|
stack for large precisions.
|
||||||
|
|
||||||
2007-04-30 Jakub Jelinek <jakub@redhat.com>
|
2007-04-30 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* stdio-common/printf_fp.c (___printf_fp): Don't print negative sign
|
* stdio-common/printf_fp.c (___printf_fp): Don't print negative sign
|
||||||
|
@@ -1160,19 +1160,25 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
|
|||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
/* In case we have a multibyte character set the \
|
/* In case we have a multibyte character set the \
|
||||||
situation is more compilcated. We must not copy \
|
situation is more complicated. We must not copy \
|
||||||
bytes at the end which form an incomplete character. */\
|
bytes at the end which form an incomplete character. */\
|
||||||
wchar_t ignore[prec]; \
|
wchar_t ignore[1024]; \
|
||||||
const char *str2 = string; \
|
const char *str2 = string; \
|
||||||
mbstate_t ps; \
|
const char *strend = string + prec; \
|
||||||
|
if (strend < string) \
|
||||||
|
strend = (const char *) UINTPTR_MAX; \
|
||||||
\
|
\
|
||||||
|
mbstate_t ps; \
|
||||||
memset (&ps, '\0', sizeof (ps)); \
|
memset (&ps, '\0', sizeof (ps)); \
|
||||||
if (__mbsnrtowcs (ignore, &str2, prec, prec, &ps) \
|
\
|
||||||
== (size_t) -1) \
|
while (str2 != NULL && str2 < strend) \
|
||||||
{ \
|
if (__mbsnrtowcs (ignore, &str2, strend - str2, 1024, \
|
||||||
done = -1; \
|
&ps) == (size_t) -1) \
|
||||||
goto all_done; \
|
{ \
|
||||||
} \
|
done = -1; \
|
||||||
|
goto all_done; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
if (str2 == NULL) \
|
if (str2 == NULL) \
|
||||||
len = strlen (string); \
|
len = strlen (string); \
|
||||||
else \
|
else \
|
||||||
|
Reference in New Issue
Block a user