Author: crab
Date: Mon Apr 20 11:59:40 2009
New Revision: 35080
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35080&view=rev
Log:
Added an additional VALIDATE call to prevent potential segfault in
attack::attack
Modified:
trunk/src/actions.cpp
Modified: trunk/src/actions.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=35080&r1=35079&r2=35080&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Mon Apr 20 11:59:40 2009
@@ -929,6 +929,8 @@
}
a_.get_unit().set_attacks(a_.get_unit().attacks_left()-1);
+ VALIDATE(attack_with < static_cast<int>(a_.get_unit().attacks().size()),
+ _("An invalid attacker weapon got selected."));
a_.get_unit().set_movement(a_.get_unit().movement_left()-a_.get_unit().attacks()[attack_with].movement_used());
a_.get_unit().set_state("not_moved","");
d_.get_unit().set_resting(false);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits