msvcrt: Fixed strncpy_s behavior when count equals 0.

This commit is contained in:
Piotr Caban 2012-09-07 16:58:23 +02:00 committed by Alexandre Julliard
parent 42d75be69d
commit bdf9a9f9bd
1 changed files with 4 additions and 1 deletions

View File

@ -598,8 +598,11 @@ int CDECL strncpy_s(char *dest, MSVCRT_size_t numberOfElements,
TRACE("(%s %lu %s %lu)\n", dest, numberOfElements, src, count);
if(!count)
if(!count) {
if(dest && numberOfElements)
*dest = 0;
return 0;
}
if (!MSVCRT_CHECK_PMT(dest != NULL)) return MSVCRT_EINVAL;
if (!MSVCRT_CHECK_PMT(src != NULL)) return MSVCRT_EINVAL;