From 6c1fdbad2425af40554dbe8b9bec4fd317444b75 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 17 Mar 2024 22:51:35 +0100 Subject: Replaced sprintf() calls --- FICS/movecheck.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'FICS/movecheck.c') diff --git a/FICS/movecheck.c b/FICS/movecheck.c index df24a3b..2089fa6 100644 --- a/FICS/movecheck.c +++ b/FICS/movecheck.c @@ -38,6 +38,10 @@ #include "playerdb.h" #include "utils.h" +#if __linux__ +#include +#endif + /* * Simply tests if the input string is a move or not. If it matches * patterns below. Add to this list as you improve the move parser. @@ -818,11 +822,11 @@ move_calculate(game_state_t *gs, move_t *mt, int promote) if (piecetype(gs->board[mt->fromFile][mt->fromRank]) == KING && mt->fromFile == 4 && mt->toFile == 2) { - sprintf(mt->moveString, "o-o-o"); + strlcpy(mt->moveString, "o-o-o", sizeof mt->moveString); } else if (piecetype(gs->board[mt->fromFile][mt->fromRank]) == KING && mt->fromFile == 4 && mt->toFile == 6) { - sprintf(mt->moveString, "o-o"); + strlcpy(mt->moveString, "o-o", sizeof mt->moveString); } else { ret = snprintf(mt->moveString, sizeof mt->moveString, "%s/%c%d-%c%d", -- cgit v1.2.3