diff options
Diffstat (limited to 'FICS/matchproc.c')
-rw-r--r-- | FICS/matchproc.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/FICS/matchproc.c b/FICS/matchproc.c index c66c688..1b1eab8 100644 --- a/FICS/matchproc.c +++ b/FICS/matchproc.c @@ -31,6 +31,9 @@ Markus Uhlin 24/12/02 com_accept: check that the accept number is within bounds. + Markus Uhlin 25/03/12 Fixed negative array + index read in + accept_match(). */ #include "stdinclude.h" @@ -312,7 +315,13 @@ accept_match(int p, int p1) unobserveAll(p); unobserveAll(p1); - which = player_find_pendfrom(p, p1, PEND_MATCH); + if ((which = player_find_pendfrom(p, p1, PEND_MATCH)) < 0) { + pprintf(p, "%s: player_find_pendfrom: error\n", __func__); + pprintf(p1, "%s accepted your challenge but a fatal error " + "occurred\n", parray[p].name); + return COM_FAILED; + } + pend = &parray[p].p_from_list[which]; wt = pend->param1; winc = pend->param2; @@ -1070,7 +1079,10 @@ com_match(int p, param_list param) .wt = wt, }; - print_bughouse(p, p1, &ctx, colorstr); + if (ctx.white >= 0) + print_bughouse(p, p1, &ctx, colorstr); + else + warnx("%s: cannot print bughouse", __func__); } if (in_list(p, L_COMPUTER, parray[p].name)) { |