msvcrt: Fix a crash in _strdup.

This commit is contained in:
Louis. Lenders 2006-06-21 09:55:11 +01:00 committed by Alexandre Julliard
parent a1910e11bb
commit 6d4a811cd5
1 changed files with 7 additions and 3 deletions

View File

@ -50,9 +50,13 @@ char* msvcrt_strndup(const char* buf, unsigned int size)
*/
char* CDECL _strdup(const char* str)
{
char * ret = MSVCRT_malloc(strlen(str)+1);
if (ret) strcpy( ret, str );
return ret;
if(str)
{
char * ret = MSVCRT_malloc(strlen(str)+1);
if (ret) strcpy( ret, str );
return ret;
}
else return 0;
}
/*********************************************************************