Commit b9d6ec3b authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

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

parent 9a4ce317
...@@ -307,7 +307,7 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, unsigned int iField, ...@@ -307,7 +307,7 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, unsigned int iField,
NULL, 0 , NULL, NULL); NULL, 0 , NULL, NULL);
WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1, WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1,
szValue, *pcchValue, NULL, NULL); szValue, *pcchValue, NULL, NULL);
if( *pcchValue && len>*pcchValue ) if( szValue && *pcchValue && len>*pcchValue )
szValue[*pcchValue-1] = 0; szValue[*pcchValue-1] = 0;
if( len ) if( len )
len--; len--;
...@@ -321,7 +321,7 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, unsigned int iField, ...@@ -321,7 +321,7 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, unsigned int iField,
break; break;
} }
if( *pcchValue <= len ) if( szValue && *pcchValue <= len )
ret = ERROR_MORE_DATA; ret = ERROR_MORE_DATA;
*pcchValue = len; *pcchValue = len;
...@@ -383,13 +383,13 @@ UINT MSI_RecordGetStringW(MSIRECORD *rec, unsigned int iField, ...@@ -383,13 +383,13 @@ UINT MSI_RecordGetStringW(MSIRECORD *rec, unsigned int iField,
break; break;
case MSIFIELD_NULL: case MSIFIELD_NULL:
len = 1; len = 1;
if( *pcchValue > 0 ) if( szValue && *pcchValue > 0 )
szValue[0] = 0; szValue[0] = 0;
default: default:
break; break;
} }
if( *pcchValue <= len ) if( szValue && *pcchValue <= len )
ret = ERROR_MORE_DATA; ret = ERROR_MORE_DATA;
*pcchValue = len; *pcchValue = len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment