From: Carl Worth Date: Fri, 29 Feb 2008 05:23:24 +0000 (-0800) Subject: Fix check for out-of-range values passed to loa_board_move_legal X-Git-Url: https://git.cworth.org/git?p=loudgame;a=commitdiff_plain;h=b61845704f880755cbfc2574ac1b3eca8d237f20 Fix check for out-of-range values passed to loa_board_move_legal Previously we were only checking the first coordinate pair instead of both. Oops. --- diff --git a/loa-board.c b/loa-board.c index 5eb9cc5..8ea6f99 100644 --- a/loa-board.c +++ b/loa-board.c @@ -186,7 +186,9 @@ loa_board_move_legal (loa_board_t *board, int dx, dy; int step_x, step_y; - if (x1 < 0 || y1 < 0 || x1 >= LOA_BOARD_SIZE || y1 >= LOA_BOARD_SIZE) { + if (x1 < 0 || y1 < 0 || x1 >= LOA_BOARD_SIZE || y1 >= LOA_BOARD_SIZE || + x2 < 0 || y2 < 0 || x2 >= LOA_BOARD_SIZE || y2 >= LOA_BOARD_SIZE) + { *error = "Invalid coordinates (not on board)"; return FALSE; }