diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-07-06 22:30:34 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-07-06 22:30:34 +0200 |
commit | 06f9395a1a3eb13dcdcf8ca1ae48bceb2a2b2e64 (patch) | |
tree | b167ac2e9ccc0cc0c352d44511da27fc6d0997b9 | |
parent | fdcefa6e40e2368eee1bff84ec33021b8bf3ab0b (diff) |
Added parameter 'size' to MakeFENpos() and replaced strcpy()
-rw-r--r-- | FICS/gamedb.c | 4 | ||||
-rw-r--r-- | FICS/gamedb.h | 2 | ||||
-rw-r--r-- | FICS/gameproc.c | 4 | ||||
-rw-r--r-- | FICS/matchproc.c | 3 | ||||
-rw-r--r-- | FICS/obsproc.c | 6 |
5 files changed, 11 insertions, 8 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c index 55330cb..99f7a85 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -199,9 +199,9 @@ game_finish(int g) } PUBLIC void -MakeFENpos(int g, char *FEN) +MakeFENpos(int g, char *FEN, size_t size) { - strcpy(FEN, boardToFEN(g)); + mstrlcpy(FEN, boardToFEN(g), size); } PUBLIC char * diff --git a/FICS/gamedb.h b/FICS/gamedb.h index cbc96af..375b2c9 100644 --- a/FICS/gamedb.h +++ b/FICS/gamedb.h @@ -170,7 +170,7 @@ extern int journal_get_info(int, char, char *, int *, char *, int *, char *, int *, int *, char *, char *, char *, char *); extern int pgames(int, int, char *); extern int pjournal(int, int, char *); -extern void MakeFENpos(int, char *); +extern void MakeFENpos(int, char *, size_t); extern void RemHist(char *); extern void addjournalitem(int, char, char *, int, char *, int, char *, int, int, char *, char *, char *, char *); diff --git a/FICS/gameproc.c b/FICS/gameproc.c index 8dc82f6..b4a538e 100644 --- a/FICS/gameproc.c +++ b/FICS/gameproc.c @@ -481,7 +481,7 @@ process_move(int p, char *command) result = execute_move(&garray[g].game_state, &move, 1); move.atTime = now; // XXX move.tookTime = 0; - MakeFENpos(g, (char *)move.FENpos); + MakeFENpos(g, (char *)move.FENpos, ARRAY_SIZE(move.FENpos)); garray[g].examMoveList[garray[g].numHalfMoves - 1] = move; /* @@ -693,7 +693,7 @@ process_move(int p, char *command) } #endif - MakeFENpos(g, (char *)move.FENpos); + MakeFENpos(g, (char *)move.FENpos, ARRAY_SIZE(move.FENpos)); garray[g].moveList[garray[g].numHalfMoves - 1] = move; } diff --git a/FICS/matchproc.c b/FICS/matchproc.c index 278ed99..58948a3 100644 --- a/FICS/matchproc.c +++ b/FICS/matchproc.c @@ -288,7 +288,8 @@ create_new_match(int white_player, int black_player, int wt, int winc, int bt, parray[black_player].side = BLACK; parray[black_player].promote = QUEEN; send_boards(g); - MakeFENpos(g, (char *)garray[g].FENstartPos); + MakeFENpos(g, (char *)garray[g].FENstartPos, + ARRAY_SIZE(garray[g].FENstartPos)); return COM_OK; } diff --git a/FICS/obsproc.c b/FICS/obsproc.c index 5a99b75..6a41e6c 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -826,7 +826,8 @@ ExamineScratch(int p, param_list param) garray[g].white_rating = garray[g].black_rating = parray[p].s_stats.rating; send_boards(g); - MakeFENpos(g, (char *)garray[g].FENstartPos); + MakeFENpos(g, (char *)garray[g].FENstartPos, + ARRAY_SIZE(garray[g].FENstartPos)); } PRIVATE int @@ -879,7 +880,8 @@ ExamineStored(FILE *fp, int p, char *filename) parray[p].side = WHITE; send_boards(g); - MakeFENpos(g, (char *)garray[g].FENstartPos); + MakeFENpos(g, (char *)garray[g].FENstartPos, + ARRAY_SIZE(garray[g].FENstartPos)); return g; } |