This is the mail archive of the
mailing list for the glibc project.
strcpy_s, strlcpy, and strncpy and checking for overflow
- From: "Yuhong Bao" <yuhongbao_386 at hotmail dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 04 May 2007 23:57:01 -0700
- Subject: strcpy_s, strlcpy, and strncpy and checking for overflow
strncpy makes it hard to check for overflow.
strlcpy make it much easier to check for overflow.
strcpy_s (part of the VC2005 libraries) do not copy the string at all if
overflow has happened. You must use strncpy_s with _TRUNCATE specified in
the count parameter to truncate.
Download Messenger. Join the i?m Initiative. Help make a difference today.