use of strncpy and strlen

Andrew Bartlett abartlet at pcug.org.au
Tue Jan 15 17:04:03 GMT 2002


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.
> 
> Just my 1 cents worth. =)

Yep, I fixed up a pile of these in passdb in HEAD, but they havn't made
it to 2.2 yet.

Can you give a list?  These need to be squahed...

Andrew Bartlett

-- 
Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net




More information about the samba-technical mailing list