<div dir="ltr">On Tue, Jul 23, 2013 at 12:48 PM, Nico Rieck <span dir="ltr"><<a href="mailto:nico.rieck@gmail.com" target="_blank">nico.rieck@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On 23.07.2013 18:43, Reid Kleckner wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Is there a problem if the string is not null terminated?  If not, you can<br>
snprintf it right into place instead of doing sprintf+mempcy.<br>
</blockquote>
<br></div>
snprintf always null-terminates (and truncates if there's not enough space).</blockquote><div><br></div><div>Nuh uh: "The _snprintf function formats and stores count or fewer characters in buffer, and appends a terminating null character if the formatted string length is strictly less than count characters."</div>
<div><a href="http://msdn.microsoft.com/en-us/library/2ts7cx93(v=vs.100).aspx">http://msdn.microsoft.com/en-us/library/2ts7cx93(v=vs.100).aspx</a><br></div><div><br></div><div>Please don't assume snprintf always null terminates.</div>
<div><br></div><div>This may be Windows-specific behavior that you shouldn't rely on.  If that's the case, ignore my suggestion.</div></div></div></div>