]> git.cworth.org Git - loudgame/blobdiff - loa-board.c
Fix check for out-of-range values passed to loa_board_move_legal
[loudgame] / loa-board.c
index 5eb9cc5ab4984b87a8b050e06a8b20c2ada3b0c3..8ea6f99d36bb45ad758011bee975ef57faf3c86a 100644 (file)
@@ -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;
     }