This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strcpy_s, strlcpy, and strncpy and checking for overflow


One of the arguments is that programmers should be concerned when a string buffer oveflow, and so my point is that that strlcpy make it easier to check overflow and strcpy_s refuse to copy the string at all if the buffer overflows.
Regardless it is not part of a standard yet, so it may not be a good idea to add it to glibc.


From: Mike Frysinger <vapier@gentoo.org>
To: libc-alpha@sourceware.org
CC: "Yuhong Bao" <yuhongbao_386@hotmail.com>
Subject: Re: strcpy_s, strlcpy, and strncpy and checking for overflow
Date: Sun, 6 May 2007 03:28:40 -0400
MIME-Version: 1.0
Received: from smtp.gentoo.org ([140.211.166.183]) by bay0-mc8-f13.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Sun, 6 May 2007 00:28:19 -0700
Received: from ip6-localhost (localhost [127.0.0.1])by smtp.gentoo.org (Postfix) with ESMTP id F14676491D;Sun, 6 May 2007 07:28:18 +0000 (UTC)
X-Message-Info: LsUYwwHHNt3660MmjhEvYg2f34OAemlK+ZzoV09lDsZmbz8QigGIQtU5Yvr3lK0P
Organization: wh0rd.org
User-Agent: KMail/1.9.6
References: <BAY109-F23EFF6F0F09BC121E5D10FC3470@phx.gbl>
Return-Path: vapier@gentoo.org
X-OriginalArrivalTime: 06 May 2007 07:28:19.0817 (UTC) FILETIME=[1EDD1590:01C78FB0]


On Saturday 05 May 2007, Yuhong Bao wrote:
> But one of the arguments is that programmers should be concerned about the
> effect of truncation. strlcpy make it easier than strncpy to check for
> truncation too, and strcpy_s (part of VC2005 libraries) refuse to copy the
> string at all if the string is going to be truncated. You must use
> strncpy_s with _TRUNCATE in the count parameter.


what exactly is your point ?  do you want to change something in glibc ?
-mike


<< signature.asc >>

_________________________________________________________________
Add the Windows Live Messenger NHL Stats Agent to your buddy list and get your stats fix instantly http://sports.sympatico.msn.ca/NHL/NHL_Stats_Agent



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]