--- a/src/chess/rules.c Sat Jul 18 21:18:07 2026 +0200 +++ b/src/chess/rules.c Sat Jul 18 21:18:38 2026 +0200 @@ -716,15 +716,17 @@ } } -static int eval_move1(char *mstr, Move *move, uint8_t color) { +static int eval_move1(const char *pstr, Move *move, uint8_t color) { memset(move, 0, sizeof(Move)); move->fromfile = POS_UNSPECIFIED; move->fromrow = POS_UNSPECIFIED; - size_t len = strlen(mstr); + size_t len = strlen(pstr); if (len < 1 || len > 6) { return INVALID_MOVE_SYNTAX; } + char mstr[8]; + strcpy(mstr, pstr); /* evaluate check/checkmate flags */ if (mstr[len-1] == '+' || mstr[len-1] == '#') { @@ -844,7 +846,8 @@ return VALID_MOVE_SYNTAX; } -int eval_move(GameState *gamestate, char *mstr, Move *move, uint8_t color) { +int eval_move(GameState *gamestate, const char *mstr, + Move *move, uint8_t color) { int result = eval_move1(mstr, move, color); if (result == VALID_MOVE_SYNTAX) { if (move->fromfile == POS_UNSPECIFIED @@ -857,7 +860,7 @@ return result; } -int check_move(char *mstr, uint8_t color) { +int check_move(const char *mstr, uint8_t color) { Move move; return eval_move1(mstr, &move, color); }