diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2025-03-12 00:45:44 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2025-03-12 00:45:44 +0100 |
commit | 2794e35653b2fa2ecd4a08c2993026362dc03745 (patch) | |
tree | 34d325d2fbfdb5dc74c379ca09ade8b7926c4206 /FICS | |
parent | d9e86717ffb0c5a5a966a14576c7eeac65c6c6f9 (diff) |
accept_match: fixed negative array index read
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/matchproc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/FICS/matchproc.c b/FICS/matchproc.c index c66c688..fb13439 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; |