libroot/glibc: apply upstream fix for _itoa: "Make sure at least a zero is emitted."

6cae39579b
fix #18098
Change-Id: I1b29f8cf723bf0731ed0be3a2ab3d2b152af449c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5833
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Jérôme Duval 2022-11-27 11:33:51 +01:00
parent 3a42882e0f
commit 17ec9b7f4e

View File

@ -1,5 +1,5 @@
/* Internal function for converting integers to ASCII.
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2002, 2003
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2002, 2003, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund <tege@matematik.su.se>
@ -233,6 +233,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)
@ -418,6 +419,8 @@ _itoa (value, buflim, base, upper_case)
}
while (n != 0);
#endif
if (buflim == bufend)
*--buflim = '0';
}
break;
}