aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-03-23 11:53:44 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-03-23 11:53:44 +0100
commite9e27eafae7ecbc77b1a74c4abcd7fd2661ff1dd (patch)
tree1422f60851a894f7146706b1f8913dd9c48dafe9 /FICS
parent5e36f2d5f34d528f747b81536a1aa90324a84291 (diff)
Added param 'size' to append_holding_display() and replaced strcat() calls
Diffstat (limited to 'FICS')
-rw-r--r--FICS/board.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/FICS/board.c b/FICS/board.c
index 0e21926..b3ad95a 100644
--- a/FICS/board.c
+++ b/FICS/board.c
@@ -170,14 +170,15 @@ append_holding_machine(char *buf, const size_t size, int g, int c, int p)
}
PRIVATE char *
-append_holding_display(char *buf, game_state_t *gs, int white)
+append_holding_display(char *buf, const size_t size, game_state_t *gs,
+ int white)
{
if (white)
- strcat(buf, "White holding: [");
+ strlcat(buf, "White holding: [", size);
else
- strcat(buf, "Black holding: [");
- strcat(buf, holding_str(gs->holding[white ? 0 : 1]));
- strcat(buf, "]\n");
+ strlcat(buf, "Black holding: [", size);
+ strlcat(buf, holding_str(gs->holding[white ? 0 : 1]), size);
+ strlcat(buf, "]\n", size);
return buf;
}
@@ -246,8 +247,10 @@ board_to_string(char *wn, char *bn, int wt, int bt, game_state_t *b, move_t *ml,
} else
bstring[0] = '\0';
- if (bh && !IsMachineStyle(style))
- append_holding_display(bstring, b, (orientation == BLACK));
+ if (bh && !IsMachineStyle(style)) {
+ append_holding_display(bstring, sizeof bstring, b,
+ (orientation == BLACK));
+ }
if (styleFuncs[style] (b, ml))
return NULL;
if (bh) {
@@ -255,7 +258,7 @@ board_to_string(char *wn, char *bn, int wt, int bt, game_state_t *b, move_t *ml,
append_holding_machine(bstring, sizeof bstring,
b->gameNum, 0, 0);
else {
- append_holding_display(bstring, b,
+ append_holding_display(bstring, sizeof bstring, b,
(orientation == WHITE));
}
}