Add strncpyW to unicode.h

James Hawkins truiken at gmail.com
Mon Apr 25 09:23:00 CDT 2005


On 4/25/05, Jeff Latimer <jeffl at defcen.gov.au> wrote:
> I have just been reading the lists and realise that strncpyW/strncpy is
> bad news for some reason.  Please consider this patch withdrawn.
> 
> Wouldn't it be better to implement strncpyW as a wrapper for memcpy?
> Given that all the other string functions are implemeted with the (W)
> version, having strncpyW missing is a bit confusing.
> 

Quoted from winehq.org Janitorial Page:

"strncpy(dst,src,n) has two subtle problems. The first is that it
always fills the whole dst buffer (n characters). The second is that
it doesn't always nul terminate the dst buffer that it's filling. 
Wine code should avoid the use of strncpy for these reasons, and
instead use lstrcpynA/W or memcpy."


-- 
James Hawkins




More information about the wine-devel mailing list