Suspicious code. listboxData->listLength which is Short is compared and assigned to Int newLength
|
void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) |
|
{ |
|
ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); |
|
|
|
|
|
// ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); |
|
// ListEntry *newData = (ListEntry *)malloc(newLength * sizeof(ListEntry)); |
|
DEBUG_ASSERTCRASH(listboxData, ("We don't have our needed listboxData!")); |
|
if( !listboxData ) |
|
return; |
|
DEBUG_ASSERTCRASH(listboxData->columns > 0,("We need at least one Column in the listbox")); |
|
if( listboxData->columns < 1 ) |
|
return; |
|
|
|
Int columns = listboxData->columns; |
|
ListEntryRow *newData = NEW ListEntryRow[ newLength ]; |
|
DEBUG_ASSERTCRASH(newData, ("Unable to allocate new data structures for the Listbox")); |
|
if( !newData ) |
|
return; |
|
Int i; |
|
// zero out the new Data structure |
|
memset( newData, 0, newLength * sizeof( ListEntryRow ) ); |
|
|
|
// we want to copy over different amounts of data depending on if we're adding |
|
// to the list box or removing from the listbox |
|
if(newLength >= listboxData->listLength) |
|
{ |
|
memcpy(newData,listboxData->listData,listboxData->listLength * sizeof( ListEntryRow ) ); |
|
} |
Suspicious code.
listboxData->listLengthwhich isShortis compared and assigned toInt newLengthGeneralsGameCode/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp
Lines 2476 to 2504 in a40cdb6