about summary refs log tree commit diff
path: root/stdio-common/_itoa.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /stdio-common/_itoa.c
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
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 f61b23fceb..285fde2ab9 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;
     }