msi: Use FIELD_OFFSET for the size of structs with a varlength array.
This commit is contained in:
parent
c34769cfa1
commit
62029ff586
@ -1135,7 +1135,7 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||||||
|
|
||||||
msi_dialog_map_events(dialog, name);
|
msi_dialog_map_events(dialog, name);
|
||||||
|
|
||||||
control = msi_alloc( sizeof(*control) + strlenW(name) * sizeof(WCHAR) );
|
control = msi_alloc( FIELD_OFFSET(msi_control, name[strlenW( name ) + 1] ));
|
||||||
if (!control)
|
if (!control)
|
||||||
return ERROR_OUTOFMEMORY;
|
return ERROR_OUTOFMEMORY;
|
||||||
|
|
||||||
@ -3735,7 +3735,7 @@ msi_dialog *msi_dialog_create( MSIPACKAGE* package,
|
|||||||
msi_dialog_register_class();
|
msi_dialog_register_class();
|
||||||
|
|
||||||
/* allocate the structure for the dialog to use */
|
/* allocate the structure for the dialog to use */
|
||||||
dialog = msi_alloc_zero( sizeof *dialog + sizeof(WCHAR)*strlenW(szDialogName) );
|
dialog = msi_alloc_zero( FIELD_OFFSET( msi_dialog, name[strlenW( szDialogName ) + 1] ));
|
||||||
if( !dialog )
|
if( !dialog )
|
||||||
return NULL;
|
return NULL;
|
||||||
strcpyW( dialog->name, szDialogName );
|
strcpyW( dialog->name, szDialogName );
|
||||||
|
@ -79,15 +79,14 @@ void MSI_CloseRecord( MSIOBJECTHDR *arg )
|
|||||||
MSIRECORD *MSI_CreateRecord( UINT cParams )
|
MSIRECORD *MSI_CreateRecord( UINT cParams )
|
||||||
{
|
{
|
||||||
MSIRECORD *rec;
|
MSIRECORD *rec;
|
||||||
UINT len;
|
|
||||||
|
|
||||||
TRACE("%d\n", cParams);
|
TRACE("%d\n", cParams);
|
||||||
|
|
||||||
if( cParams>65535 )
|
if( cParams>65535 )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
len = sizeof (MSIRECORD) + sizeof (MSIFIELD)*cParams;
|
rec = alloc_msiobject( MSIHANDLETYPE_RECORD, FIELD_OFFSET(MSIRECORD, fields[cParams + 1]),
|
||||||
rec = alloc_msiobject( MSIHANDLETYPE_RECORD, len, MSI_CloseRecord );
|
MSI_CloseRecord );
|
||||||
if( rec )
|
if( rec )
|
||||||
rec->count = cParams;
|
rec->count = cParams;
|
||||||
return rec;
|
return rec;
|
||||||
|
@ -1068,7 +1068,7 @@ static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns)
|
|||||||
if (count == 0)
|
if (count == 0)
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
|
||||||
orderinfo = msi_alloc(sizeof(MSIORDERINFO) + (count - 1) * sizeof(union ext_column));
|
orderinfo = msi_alloc(FIELD_OFFSET(MSIORDERINFO, columns[count]));
|
||||||
if (!orderinfo)
|
if (!orderinfo)
|
||||||
return ERROR_OUTOFMEMORY;
|
return ERROR_OUTOFMEMORY;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user