summaryrefslogtreecommitdiff
path: root/lib/vasnprintf.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-04-19 21:42:16 +0200
committerBruno Haible <bruno@clisp.org>2008-04-19 21:42:16 +0200
commit5fc2139cf34af9a059c76496c5b02eaf1ec3e3e8 (patch)
tree1836c4ef7ed987ca12d81448e07338f2a65a40a3 /lib/vasnprintf.c
parentee761da90342d654b308626640bfe1128a78a2ee (diff)
downloadgnulib-5fc2139cf34af9a059c76496c5b02eaf1ec3e3e8.tar.gz
Work around snprintf bug on Linux libc5.
Diffstat (limited to 'lib/vasnprintf.c')
-rw-r--r--lib/vasnprintf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index fbf13c8ef8..517888cf01 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -177,10 +177,12 @@ local_wcslen (const wchar_t *s)
# endif
#else
/* TCHAR_T is char. */
-# /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
+ /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
But don't use it on BeOS, since BeOS snprintf produces no output if the
- size argument is >= 0x3000000. */
-# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__
+ size argument is >= 0x3000000.
+ Also don't use it on Linux libc5, since there snprintf with size = 1
+ writes any output without bounds, like sprintf. */
+# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1)
# define USE_SNPRINTF 1
# else
# define USE_SNPRINTF 0