1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 02:36:16 +02:00

Fix a typo in the handling of %x and %X.

* vasnprintf.c (VASNPRINTF): When adding 2 to buffer length,
don't double it.
This commit is contained in:
Jim Meyering
2007-03-20 15:21:08 +01:00
parent de540a76eb
commit 13e4c87ff6
2 changed files with 9 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
2007-03-20 Jim Meyering <jim@meyering.net>
Fix a typo in the handling of %x and %X.
* vasnprintf.c (VASNPRINTF): When adding 2 to buffer length,
don't double it.
2007-03-04 Jim Meyering <jim@meyering.net>
* vasnprintf.c (VASNPRINTF): Add missing semicolon.

View File

@@ -415,8 +415,9 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
if (tmp_length < precision)
tmp_length = precision;
/* Add 2, to account for a leading sign or alternate form. */
if (tmp_length <= SIZE_MAX / 2)
tmp_length *= 2;
tmp_length += 2;
if (tmp_length < 2)
goto out_of_memory;
break;
case 'f': case 'F':