aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/movecheck.c
diff options
context:
space:
mode:
Diffstat (limited to 'FICS/movecheck.c')
-rw-r--r--FICS/movecheck.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c
index a0c9d30..5f607de 100644
--- a/FICS/movecheck.c
+++ b/FICS/movecheck.c
@@ -25,6 +25,8 @@
Markus Uhlin 23/12/24 Fixed dead assignment
Markus Uhlin 24/05/05 Refactored and reformatted all
functions.
+ Markus Uhlin 25/03/21 Fixed out-of-bounds array access
+ in has_legal_move().
*/
#include "stdinclude.h"
@@ -967,8 +969,10 @@ has_legal_move(game_state_t *gs)
&numpossible);
break;
}
- if (numpossible >= 500)
+ if (numpossible >= 500) {
fprintf(stderr, "FICS: Possible move overrun\n");
+ return 0;
+ }
for (i = 0; i < numpossible; i++) {
if (legal_andcheck_move(gs, f, r, possiblef[i],
possibler[i]))