summaryrefslogtreecommitdiff
path: root/jouer.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-08 17:03:33 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-08 17:10:29 +0100
commite3b507957242134019dd12b4be73350f0ead6475 (patch)
tree3275d3627df87b4c8b81c9c83f9032924fc63092 /jouer.c
parent921cea1f77addd23e545ac309d32f2d0cabf551b (diff)
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 <duskcoder@gmail.com>
Diffstat (limited to 'jouer.c')
-rw-r--r--jouer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/jouer.c b/jouer.c
index 7175191..8603df7 100644
--- a/jouer.c
+++ b/jouer.c
@@ -309,7 +309,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *ally, struc
// on vérifie à présent si on a gagné ou si on a perdu !
gagne=1;
perdu=1;
- for(i = 0; i <= enemy->chr_cnt; i++) {
+ for (i = 0; i < enemy->chr_cnt; i++) {
if (enemy->chrs[i].alive)
gagne=0;
}