aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/movecheck.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-05-20 01:02:31 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-05-20 01:02:31 +0200
commitb893b787cf33db7b9672b44c31066224b5cfd70e (patch)
tree27bbdf1f3139ce836bef5a2f99ec5950e2a0b26c /FICS/movecheck.c
parent9306df8640f0c2162380ace94e0a9aaaf010937f (diff)
Replaced evil sprintf() calls
Diffstat (limited to 'FICS/movecheck.c')
-rw-r--r--FICS/movecheck.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c
index 38255d5..a0c9d30 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.
@@ -817,11 +821,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",