msi: Fixed buffer overflow in number parsing.
This commit is contained in:
parent
0e7ca5863c
commit
964a0303c1
|
@ -2464,7 +2464,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
|
||||||
{
|
{
|
||||||
LPCWSTR text = MSI_RecordGetString( rec, 10 );
|
LPCWSTR text = MSI_RecordGetString( rec, 10 );
|
||||||
LPCWSTR begin = text, end;
|
LPCWSTR begin = text, end;
|
||||||
WCHAR num[10];
|
WCHAR *num;
|
||||||
LVCOLUMNW lvc;
|
LVCOLUMNW lvc;
|
||||||
DWORD count = 0;
|
DWORD count = 0;
|
||||||
|
|
||||||
|
@ -2478,6 +2478,10 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
|
||||||
if (!(end = strchrW( begin, '}' )))
|
if (!(end = strchrW( begin, '}' )))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
num = msi_alloc( (end-begin+1)*sizeof(WCHAR) );
|
||||||
|
if (!num)
|
||||||
|
return;
|
||||||
|
|
||||||
lstrcpynW( num, begin + 1, end - begin );
|
lstrcpynW( num, begin + 1, end - begin );
|
||||||
begin += end - begin + 1;
|
begin += end - begin + 1;
|
||||||
|
|
||||||
|
@ -2485,14 +2489,17 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
|
||||||
if ( !num[0] || !lstrcmpW( num, zero ) )
|
if ( !num[0] || !lstrcmpW( num, zero ) )
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
|
msi_free( num );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the width must be a positive number
|
/* the width must be a positive number
|
||||||
* if a width is invalid, all remaining columns are hidden
|
* if a width is invalid, all remaining columns are hidden
|
||||||
*/
|
*/
|
||||||
if ( !strncmpW( num, negative, 1 ) || !str_is_number( num ) )
|
if ( !strncmpW( num, negative, 1 ) || !str_is_number( num ) ) {
|
||||||
|
msi_free( num );
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ZeroMemory( &lvc, sizeof(lvc) );
|
ZeroMemory( &lvc, sizeof(lvc) );
|
||||||
lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
|
lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
|
||||||
|
@ -2501,6 +2508,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
|
||||||
|
|
||||||
SendMessageW( control->hwnd, LVM_INSERTCOLUMNW, count++, (LPARAM)&lvc );
|
SendMessageW( control->hwnd, LVM_INSERTCOLUMNW, count++, (LPARAM)&lvc );
|
||||||
msi_free( lvc.pszText );
|
msi_free( lvc.pszText );
|
||||||
|
msi_free( num );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue