Commit 9fcbc544 authored by Michael McCormack's avatar Michael McCormack Committed by Alexandre Julliard

Modified lstrcpynWtoA to put terminating null at end of string, not

end of buffer.
parent 486dee90
......@@ -437,12 +437,18 @@ LPWSTR WINAPI lstrcpynAtoW( LPWSTR dst, LPCSTR src, INT n )
* lstrcpynWtoA (Not a Windows API)
* Note: this function differs from the UNIX strncpy, it _always_ writes
* a terminating \0
*
* The terminating zero should be written at the end of the string, not
* the end of the buffer, as some programs specify the wrong size for
* the buffer (eg. winnt's sol.exe)
*/
LPSTR WINAPI lstrcpynWtoA( LPSTR dst, LPCWSTR src, INT n )
{
if (--n >= 0)
{
CRTDLL_wcstombs( dst, src, n );
n = CRTDLL_wcstombs( dst, src, n );
if(n<0)
n=0;
dst[n] = 0;
}
return dst;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment