Commit 34400353 authored by Ulrich Czekalla's avatar Ulrich Czekalla Committed by Alexandre Julliard

Handle 0 length buffers in MSI_FormatRecordW.

Remove unused buffer in deformat_string.
parent 7acd3639
......@@ -518,10 +518,9 @@ DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data )
{
MSIRECORD *rec = MSI_CreateRecord(1);
DWORD size = 0;
WCHAR size_buf[2] = {' ',0};
MSI_RecordSetStringW(rec,0,ptr);
MSI_FormatRecordW(package,rec,size_buf,&size);
MSI_FormatRecordW(package,rec,NULL,&size);
if (size >= 0)
{
size++;
......
......@@ -451,9 +451,12 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer,
}
else
{
memcpy(buffer,deformated,(*size)*sizeof(WCHAR));
if (*size > 0)
{
memcpy(buffer,deformated,(*size)*sizeof(WCHAR));
buffer[(*size)-1] = 0;
}
rc = ERROR_MORE_DATA;
buffer[(*size)-1] = 0;
}
}
else
......
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