use of strncpy and strlen

Jeremy Allison jra at samba.org
Tue Jan 15 16:59:03 GMT 2002


On Wed, Jan 16, 2002 at 11:33:31AM +1100, Benjamin Kuit wrote:
> 
> Not sure if the respective developers are aware of the problem, but
> there are some occurances whereby people use Strncpy (or strncpy) with
> strlen like this:
> 
> Strncpy(dest, src, strlen(src));
> 
> Instead of using the size of the destination buffer for the length
> parameter.
> 
> The developers might aswell #undef strcpy and use it instead.

Yes, I want to move to strlcpy/strlcat instead. That's in the
roadmap.... 

Jeremy.




More information about the samba-technical mailing list