libwine: Fix a potential write through a null pointer. (Clang).

oldstable
Ken Thomases 2013-10-20 23:55:47 -05:00 committed by Alexandre Julliard
parent 9a7993045e
commit e577e4b3e6
1 changed files with 7 additions and 4 deletions

View File

@ -985,10 +985,13 @@ void *wine_dlopen( const char *filename, int flag, char *error, size_t errorsize
{
if (pread( fd, magic, 2, 0 ) == 2 && magic[0] == 'M' && magic[1] == 'Z')
{
static const char msg[] = "MZ format";
size_t len = min( errorsize, sizeof(msg) );
memcpy( error, msg, len );
error[len - 1] = 0;
if (error && errorsize)
{
static const char msg[] = "MZ format";
size_t len = min( errorsize, sizeof(msg) );
memcpy( error, msg, len );
error[len - 1] = 0;
}
close( fd );
return NULL;
}