gcvt(3) is documented as MT-Safe, AS-Safe, AC-Safe

Alejandro Colomar alx@kernel.org
Wed May 1 15:18:22 GMT 2024


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/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20240501/256c487e/attachment.sig>


More information about the Libc-alpha mailing list