Skip to content

Commit 8dd6190

Browse files
Fix array overrun in compute_damage().
Should not attempt to handle "special" effect types for unaffected objects, since there is no entry in the effects table for it.
1 parent ee77206 commit 8dd6190

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/GameSrc/damage.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -951,10 +951,15 @@ int compute_damage(ObjID target, int damage_type, int damage_mod, ubyte offense,
951951
*effect = effect_matrix[NON_CRITTER_EFFECT][attack_effect_type][0];
952952
} else if (effect != NULL)
953953
*effect = 0;
954-
} else {
954+
} else if (attack_effect_type != SPECIAL_TYPE) {
955955
// we didn't affect - so do the no effect one!
956956
if (effect)
957957
*effect = (!global_fullmap->cyber) ? effect_matrix[NON_CRITTER_EFFECT][attack_effect_type][0] : 0;
958+
} else {
959+
// Special damage type with no damage = no effect.
960+
if (effect) {
961+
*effect = 0;
962+
}
958963
}
959964

960965
return (damage);

0 commit comments

Comments
 (0)