mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
SAGA2: Fix out-of-bounds read.. CID 1457984
This commit is contained in:
parent
a7650b1039
commit
42c888f8c8
@ -95,15 +95,15 @@ GameObject *GetOwner(GameObject *go) {
|
||||
// This call looks up a spells object prototype. It can accept either
|
||||
// an object ID or a spell ID
|
||||
SkillProto *skillProtoFromID(int16 spellOrObjectID) {
|
||||
if (spellOrObjectID > MAX_SPELLS)
|
||||
return (SkillProto *) GameObject::protoAddress(spellOrObjectID);
|
||||
if (spellOrObjectID >= MAX_SPELLS)
|
||||
return (SkillProto *)GameObject::protoAddress(spellOrObjectID);
|
||||
return spellBook[spellOrObjectID].getProto();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// initialization call to connect skill prototypes with their spells
|
||||
void initializeSkill(SkillProto *oNo, SpellID sNo) {
|
||||
if (sNo > 0 && sNo <= MAX_SPELLS - 1) {
|
||||
if (sNo > 0 && sNo < MAX_SPELLS) {
|
||||
if (spellBook[sNo].getProto() != NULL)
|
||||
error("Duplicate prototype for spell %d", sNo);
|
||||
spellBook[sNo].setProto(oNo);
|
||||
|
Loading…
Reference in New Issue
Block a user