Fix possible buffer overreach when selecting a shop item
Thanks to @fosnola for the fix.
This commit is contained in:
@@ -220,7 +220,9 @@ void handle_shop_event(location p) {
|
||||
}
|
||||
|
||||
for(short i = 0; i < 8; i++) {
|
||||
unsigned long what_picked = shop_array[i + shop_sbar->getPosition()];
|
||||
auto shop_i = i + shop_sbar->getPosition();
|
||||
if(shop_i >= shop_array.size()) break;
|
||||
unsigned long what_picked = shop_array[shop_i];
|
||||
if(what_picked >= active_shop.size()) break;
|
||||
if(active_shop.getItem(what_picked).type == eShopItemType::EMPTY)
|
||||
break;
|
||||
|
Reference in New Issue
Block a user