<span style=" font-size:10pt;font-family:sans-serif">So it seems glibc
does do the right thing (null terminate) and the web page was wrong.</span><br><br><span style=" font-size:10pt;font-family:sans-serif">Regards,<br><br>Rajan Bhakta<br>z/OS XL C/C++ Compiler Technical Architect<br>ISO C Standards Representative for Canada, PL22.11 Chair (USA)<br>C Compiler Development<br>Contact: rbhakta@us.ibm.com, Rajan Bhakta/Houston/IBM</span><br><span style=" font-size:9pt;color:#800080;font-family:sans-serif">-----
Forwarded by Rajan Bhakta/Houston/IBM on 02/19/2020 08:04 PM -----</span><br><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">From:
</span><span style=" font-size:9pt;font-family:sans-serif">Joseph
Myers <joseph@codesourcery.com></span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">To:
</span><span style=" font-size:9pt;font-family:sans-serif">Rajan
Bhakta <rbhakta@us.ibm.com></span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">Date:
</span><span style=" font-size:9pt;font-family:sans-serif">02/19/2020
04:20 PM</span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">Subject:
</span><span style=" font-size:9pt;font-family:sans-serif">[EXTERNAL]
Re: Question about strfromd in glibc</span><br><hr noshade><br><br><br><tt><span style=" font-size:10pt">On Wed, 19 Feb 2020, Rajan Bhakta
wrote:<br><br>> Hi Joseph,<br>> <br>> Looking at </span></tt><a href="http://man7.org/linux/man-pages/man3/strfromd.3.html"><tt><span style=" font-size:10pt">http://man7.org/linux/man-pages/man3/strfromd.3.html</span></tt></a><tt><span style=" font-size:10pt">, it seems <br>> to say you could end up with strings that are not null terminated.
But <br>> from the C standard draft (N2454 for example) it says that the strings
are <br>> always null terminated and only that you may get incomplete (truncation
<br>> from the right) if 'n' is too small (yet still null terminated). Was
this <br>> an intentional decision or am I understanding the documentation wrong?<br><br>The strfrom functions are equivalent to particular calls to snprintf, so
<br>they should always null-terminate their output (when a nonzero size is
<br>specified). The manpages are not official glibc documentation.<br><br>-- <br>Joseph S. Myers<br>joseph@codesourcery.com<br><br></span></tt><br><BR>