msi: Fix MsiRecordGetString for a null buffer and non-zero buffer length.

This commit is contained in:
Mike McCormack 2006-08-28 16:51:11 +09:00 committed by Alexandre Julliard
parent 9a4ce31737
commit b9d6ec3b87
1 changed files with 4 additions and 4 deletions

View File

@ -307,7 +307,7 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, unsigned int iField,
NULL, 0 , NULL, NULL);
WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1,
szValue, *pcchValue, NULL, NULL);
if( *pcchValue && len>*pcchValue )
if( szValue && *pcchValue && len>*pcchValue )
szValue[*pcchValue-1] = 0;
if( len )
len--;
@ -321,7 +321,7 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, unsigned int iField,
break;
}
if( *pcchValue <= len )
if( szValue && *pcchValue <= len )
ret = ERROR_MORE_DATA;
*pcchValue = len;
@ -383,13 +383,13 @@ UINT MSI_RecordGetStringW(MSIRECORD *rec, unsigned int iField,
break;
case MSIFIELD_NULL:
len = 1;
if( *pcchValue > 0 )
if( szValue && *pcchValue > 0 )
szValue[0] = 0;
default:
break;
}
if( *pcchValue <= len )
if( szValue && *pcchValue <= len )
ret = ERROR_MORE_DATA;
*pcchValue = len;