msi: Fix a buffer overrun.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4884815505
commit
39b841d189
|
@ -1812,17 +1812,17 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
|
||||||
{
|
{
|
||||||
WCHAR template_s[1024];
|
WCHAR template_s[1024];
|
||||||
WCHAR *template_rec, *template;
|
WCHAR *template_rec, *template;
|
||||||
DWORD length;
|
|
||||||
|
|
||||||
LoadStringW(msi_hInstance, IDS_INFO, template_s, 1024);
|
LoadStringW(msi_hInstance, IDS_INFO, template_s, 1024);
|
||||||
|
|
||||||
res = MSI_RecordGetStringW(record, 0, NULL, &length);
|
res = MSI_RecordGetStringW(record, 0, NULL, &len);
|
||||||
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
|
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
|
||||||
return res;
|
return res;
|
||||||
len++;
|
len++;
|
||||||
template_rec = msi_alloc(len * sizeof(WCHAR));
|
template_rec = msi_alloc(len * sizeof(WCHAR));
|
||||||
if (!template_rec) return ERROR_OUTOFMEMORY;
|
if (!template_rec) return ERROR_OUTOFMEMORY;
|
||||||
MSI_RecordGetStringW(record, 0, template_rec, &length);
|
MSI_RecordGetStringW(record, 0, template_rec, &len);
|
||||||
|
len++;
|
||||||
|
|
||||||
template = msi_alloc((len + strlenW(template_s)) * sizeof(WCHAR));
|
template = msi_alloc((len + strlenW(template_s)) * sizeof(WCHAR));
|
||||||
if (!template) return ERROR_OUTOFMEMORY;
|
if (!template) return ERROR_OUTOFMEMORY;
|
||||||
|
|
Loading…
Reference in New Issue