msvcrt: strncpy doesn't compliant C standard

Nikolay Sivov nsivov at codeweavers.com
Tue Aug 6 02:16:04 CDT 2013


On 8/6/2013 11:09, Álvaro Nieto wrote:
> This patch solves [Bug 34211]. The implementation of strncpy function 
> doesn't compliant with C standard [1]. Also Microsoft Visual Studio 
> C/C++ compiler is ok with the standard [2].
>
> Extract from msdn;
>
> "The strncpy function copies the initial count characters of strSource 
> to strDest and returns strDest. If count is less than or equal to the 
> length of strSource, a null character is not appended automatically to 
> the copied string. If count is greater than the length of strSource, 
> the destination string is padded with null characters up to length 
> count. The behavior of strncpy is undefined if the source and 
> destination strings overlap."
>
> [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/strncpy.html
> [2] http://msdn.microsoft.com/en-us/library/vstudio/xdsywd25.aspx
This needs tests.




More information about the wine-devel mailing list