[Cfp-interest 1507] Fw: Re: Question about strfromd in glibc
Rajan Bhakta
rbhakta at us.ibm.com
Wed Feb 19 18:05:27 PST 2020
So it seems glibc does do the right thing (null terminate) and the web
page was wrong.
Regards,
Rajan Bhakta
z/OS XL C/C++ Compiler Technical Architect
ISO C Standards Representative for Canada, PL22.11 Chair (USA)
C Compiler Development
Contact: rbhakta at us.ibm.com, Rajan Bhakta/Houston/IBM
----- Forwarded by Rajan Bhakta/Houston/IBM on 02/19/2020 08:04 PM -----
From: Joseph Myers <joseph at codesourcery.com>
To: Rajan Bhakta <rbhakta at us.ibm.com>
Date: 02/19/2020 04:20 PM
Subject: [EXTERNAL] Re: Question about strfromd in glibc
On Wed, 19 Feb 2020, Rajan Bhakta wrote:
> Hi Joseph,
>
> Looking at
https://urldefense.proofpoint.com/v2/url?u=http-3A__man7.org_linux_man-2Dpages_man3_strfromd.3.html&d=DwIBAg&c=jf_iaSHvJObTbx-siA1ZOg&r=MPb4GyWs7nd-w3OlFPs29W1dB3gHMdsdghhjcQMf428&m=hxILeDqVdlHoUYoqw9PFLsLVMma87WGosQbgEvRpXSk&s=x0XHdZsq7q89h2YP2NIyK2LWwaZVVoHFRuiHfxw4e34&e=
, it seems
> to say you could end up with strings that are not null terminated. But
> from the C standard draft (N2454 for example) it says that the strings
are
> always null terminated and only that you may get incomplete (truncation
> from the right) if 'n' is too small (yet still null terminated). Was
this
> an intentional decision or am I understanding the documentation wrong?
The strfrom functions are equivalent to particular calls to snprintf, so
they should always null-terminate their output (when a nonzero size is
specified). The manpages are not official glibc documentation.
--
Joseph S. Myers
joseph at codesourcery.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20200219/34eee799/attachment.html
More information about the Cfp-interest
mailing list