Skip to content

Commit a6b2292

Browse files
committed
[GEN] Fix:heap-buffer-overflow in getListBoxBottomEngry #462
1 parent d9d6efb commit a6b2292

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,17 @@ static Int getListboxBottomEntry( ListboxData *list )
202202
{
203203
Int entry;
204204

205-
// determin which entry is at the top of the display area
205+
// determine which entry is at the top of the display area
206206
for( entry=list->endPos - 1; ; entry-- )
207207
{
208+
if( entry < 0 )
209+
return 0;
208210
if( list->listData[entry].listHeight == list->displayPos + list->displayHeight )
209211
return entry;
210212
if( list->listData[entry].listHeight < list->displayPos + list->displayHeight && entry != list->endPos - 1)
211213
return entry + 1;
212214
if( list->listData[entry].listHeight < list->displayPos + list->displayHeight)
213215
return entry;
214-
if( entry < 0 )
215-
return 0;
216216
}
217217

218218
return 0;

0 commit comments

Comments
 (0)