[1/6] try 2: msvcrt: Implement strcpy_s

Stefan Dösinger stefan at codeweavers.com
Fri Nov 16 04:25:39 CST 2007


Am Freitag, 16. November 2007 00:45:47 schrieb Detlef Riekenberg:
> On Do, 2007-11-15 at 17:35 +0100, Stefan Dösinger wrote:
> > +    memset(dest, 'X', sizeof(dest));
> > +    ret = pstrcpy_s(dest, sizeof(dest), small);
> > +    ok(ret == 0, "Copying a string into a big enough destination
> > returned %d, expected 0\n", ret);
> > +    ok(dest[0] == 's' && dest[1] == 'm' && dest[2] == 'a' && dest[3]
> > == 'l' &&
> > +       dest[4] == 'l' && dest[5] == '\0'&& dest[6] == 'X' && dest[7]
> > == 'X',
>
> Is it really needed to check the memory after the end of the string?
> Does an application depend on this?
It shows that the msdn documents the function incorrectly: It says the string 
is unmodified, which is apparently not the case.

> Did you test with invalid pointers (crash / handled graceful)?
No, good idea, I'll try that now


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20071116/e7b46f3a/attachment.pgp 


More information about the wine-devel mailing list