diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 17:03:33 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 17:10:29 +0100 |
commit | e3b507957242134019dd12b4be73350f0ead6475 (patch) | |
tree | 3275d3627df87b4c8b81c9c83f9032924fc63092 /jouer.c | |
parent | 921cea1f77addd23e545ac309d32f2d0cabf551b (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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; } |