From e3b507957242134019dd12b4be73350f0ead6475 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 8 Jan 2015 17:03:33 +0100 Subject: fix invalid write in new_enemy_team and in Fjouer in the function `new_enemy_team()', we used to loop through the enemies while the incrementer is less or equal to the count. However, since there are `count' elements, we need to stop the loop when the incrementer gets equal to `count' the same bug is present in `Fjouer()' when checking if the player wins. Signed-off-by: Olivier Gayot --- menuchoixpersos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'menuchoixpersos.c') diff --git a/menuchoixpersos.c b/menuchoixpersos.c index 3a40875..f3f5cd3 100644 --- a/menuchoixpersos.c +++ b/menuchoixpersos.c @@ -109,7 +109,7 @@ static void generate_enemy_types(const struct team_t *ally_team, if (avg < 5) { /* easy */ - for (int i = 0; i <= count; i++) { + for (int i = 0; i < count; i++) { classes[i] = CLASS_WARRIOR_GOBELIN; } } else { -- cgit v1.2.3