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 /menuchoixpersos.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 'menuchoixpersos.c')
-rw-r--r-- | menuchoixpersos.c | 2 |
1 files changed, 1 insertions, 1 deletions
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 { |