use of strncpy and strlen

Benjamin Kuit bj at it.uts.edu.au
Tue Jan 15 16:40:05 GMT 2002


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. =)

Bj

-- 
+-------------------------------+--------------------------------------+
|      Benjamin (Bj) Kuit       |  Building 4, 447                     |
|      Systems Programmer       |  Faculty of Information Technology   |
|      Phone: 02 9514 1841      |  University of Technology, Sydney    |
|      Mobile: 0416 184 972     |  Email: bj at it.uts.edu.au             |
+-------------------------------+--------------------------------------+




More information about the samba-technical mailing list