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