aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-03-17 22:51:35 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-03-17 22:51:35 +0100
commit6c1fdbad2425af40554dbe8b9bec4fd317444b75 (patch)
tree49e09ec2bf9a66b3f303314e7c3c910f6c7a3f83
parent68b1a5c9221bf12e6abc0a9a2164d418798d32c4 (diff)
Replaced sprintf() calls
-rw-r--r--FICS/movecheck.c8
1 files changed, 6 insertions, 2 deletions
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 <bsd/string.h>
+#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",