[asterisk-dev] seanbright: tools/trunk r5656 - /tools/trunk/dahdi_monitor.c

Kevin P. Fleming kpfleming at digium.com
Wed Jan 14 07:29:46 CST 2009

Sean Bright wrote:

> The code in question is copying a string into the _middle_ of another
> string, and strcpy would copy the null byte at the end of the source
> string as well, resulting in the same situation we had with
> dahdi_copy_string.  strncpy allows us to specifically exclude the
> terminator.

Then if you know exactly how many bytes you want to copy, and that the
source string has that many bytes (you will not run off the end of the
buffer), just use memcpy() :-)

Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kpfleming at digium.com
Check us out at www.digium.com & www.asterisk.org

More information about the asterisk-dev mailing list