<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Well, if the strcpy/strcat/strcat sequence is safe, the corresponding sprintf is also safe (and if it wasn't safe, then the code would need to be fixed anyway).  So it's permissible and safe to use:<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    sprintf(lsp->fullname, "%s/%s", p, name);<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I was under the impression Paul had just said that using snprintf() was OK now as it was part of C99 — though he mistyped C99 as C89 in the last email I saw commenting on the subject.<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 12, 2017 at 3:41 PM, Brian Inglis <span dir="ltr"><<a href="mailto:Brian.Inglis@systematicsw.ab.ca" target="_blank">Brian.Inglis@systematicsw.ab.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2017-06-12 15:10, Christos Zoulas wrote:<br>
> On Jun 12, 11:21am, <a href="mailto:eggert@cs.ucla.edu">eggert@cs.ucla.edu</a> (Paul Eggert) wrote:<br>
> -- Subject: Re: [tz] defensive value for define on Solaris causes load of tim<br>
><br>
> |               return EINVAL;<br>
> |             if (sizeof lsp->fullname - 1 <=3D strlen(p) + strlen(name))<br>
> |               return ENAMETOOLONG;<br>
> | -           strcpy(fullname, p);<br>
> | -           strcat(fullname, "/");<br>
> | -           strcat(fullname, name);<br>
> | +           strcpy(lsp->fullname, p);<br>
> | +           strcat(lsp->fullname, "/");<br>
> | +           strcat(lsp->fullname, name);<br>
><br>
> Why not:<br>
><br>
>       snprintf(lsp->fullname, sizeof(lsp_fullname), "%s/%s", p, name);<br>
><br>
> and remove more code...<br>
</span>From another post today:<br>
> /*<br>
> ** We avoid using snprintf since it's not available on all systems.<br>
> */<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Jonathan Leffler <<a href="mailto:jonathan.leffler@gmail.com" target="_blank">jonathan.leffler@gmail.com</a>>  #include <disclaimer.h><br>Guardian of DBD::Informix - v2015.1101 - <a href="http://dbi.perl.org" target="_blank">http://dbi.perl.org</a><br>"Blessed are we who can laugh at ourselves, for we shall never cease to be amused."</div></div></div></div></div></div></div></div>
</div>