<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:
&nbsp; &nbsp; &nbsp; &nbsp;</span><span style=" font-size:9pt;font-family:sans-serif">Joseph
Myers &lt;joseph@codesourcery.com&gt;</span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">To:
&nbsp; &nbsp; &nbsp; &nbsp;</span><span style=" font-size:9pt;font-family:sans-serif">Rajan
Bhakta &lt;rbhakta@us.ibm.com&gt;</span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">Date:
&nbsp; &nbsp; &nbsp; &nbsp;</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:
&nbsp; &nbsp; &nbsp; &nbsp;</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>&gt; Hi Joseph,<br>&gt; <br>&gt; 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>&gt; to say you could end up with strings that are not null terminated.
But <br>&gt; from the C standard draft (N2454 for example) it says that the strings
are <br>&gt; always null terminated and only that you may get incomplete (truncation
<br>&gt; from the right) if 'n' is too small (yet still null terminated). Was
this <br>&gt; 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). &nbsp;The manpages are not official glibc documentation.<br><br>-- <br>Joseph S. Myers<br>joseph@codesourcery.com<br><br></span></tt><br><BR>