* gcvt(3) is documented as MT-Safe, AS-Safe, AC-Safe
@ 2024-05-01 15:18 Alejandro Colomar
0 siblings, 0 replies; only message in thread
From: Alejandro Colomar @ 2024-05-01 15:18 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 631 bytes --]
Hi,
gcvt(3) is documented as being MT-, AS-, and AC-Safe. However, the
following code calls sprintf(3), which is not safe.
$ grepc __GCVT .
./misc/efgcvt-template.c:char *
__GCVT (FLOAT_TYPE value, int ndigit, char *buf)
{
SPRINTF (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value);
return buf;
}
./misc/qefgcvt.c:#define __GCVT __qgcvt
./misc/efgcvt.c:#define __GCVT __gcvt
./sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c:#define __GCVT ___qgcvtieee128
Is that subset of sprintf(3) functionality safe?
Have a lovely day!
Alex
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-01 15:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01 15:18 gcvt(3) is documented as MT-Safe, AS-Safe, AC-Safe Alejandro Colomar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).