aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/_itoa.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-01-22 16:18:03 +0000
committerUlrich Drepper <drepper@redhat.com>2007-01-22 16:18:03 +0000
commit6cae39579b699d09b94a315483a9ac804b56fe34 (patch)
tree25e1ae56c925aac9ee267ca7626d9aa860a10604 /stdio-common/_itoa.c
parent439201dea2b759359eba24dd9458b4a2ef55bfac (diff)
downloadglibc-6cae39579b699d09b94a315483a9ac804b56fe34.zip
glibc-6cae39579b699d09b94a315483a9ac804b56fe34.tar.gz
glibc-6cae39579b699d09b94a315483a9ac804b56fe34.tar.bz2
[BZ #3902]
2007-01-22 Ulrich Drepper <drepper@redhat.com> [BZ #3902] * stdio-common/_itoa.c (_itoa): Make sure at least a zero is emitted. * stdio-common/Makefile (tests): Add bug17. * stdio-common/bug17.c: New file.
Diffstat (limited to 'stdio-common/_itoa.c')
-rw-r--r--stdio-common/_itoa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c
index f61b23f..285fde2 100644
--- a/stdio-common/_itoa.c
+++ b/stdio-common/_itoa.c
@@ -1,5 +1,5 @@
/* Internal function for converting integers to ASCII.
- Copyright (C) 1994, 1995, 1996, 1999, 2000, 2002, 2003, 2004
+ Copyright (C) 1994, 1995, 1996, 1999, 2000, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund <tege@matematik.su.se>
@@ -269,6 +269,7 @@ _itoa (value, buflim, base, upper_case)
default:
{
+ char *bufend = buflim;
#if BITS_PER_MP_LIMB == 64
mp_limb_t base_multiplier = brec->base_multiplier;
if (brec->flag)
@@ -454,6 +455,8 @@ _itoa (value, buflim, base, upper_case)
}
while (n != 0);
#endif
+ if (buflim == bufend)
+ *--buflim = '0';
}
break;
}