Array Overflow not checked
Status: Beta
Brought to you by:
gabortorok
In src/rpg/pc.h
I would change the line 90:
inline void addInventory(RpgItem *item) {
inventory[inventory_count++] = item; }
to something like this:
inline bool addInventory(RpgItem *item) {
bool res = (inventory_count < MAX_INVENTORY_SIZE);
if (res) inventory[inventory_count++] = item;
return res;
}
Logged In: NO
Hello,
Hey it's not a bug. It's only a potential bug!
Moreover this file has been deleted on CVS ;)
But you're right we should check every array like
this.
However, you know, sometimes you prefer
adding a feature than coding safe. And when it works,
you forget to "safe and clean" your code.
PS : You can contact gabor if you want to participate ? :)