diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-28 20:13:12 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-28 20:13:12 +0200 |
commit | 110938abfa36e392ea41a14932e316d288f5675e (patch) | |
tree | f0d8457afc686facd8dab4d962a02e3864b1ab40 | |
parent | a9a16300023ecde3181acf61d980f1dc1d80b82f (diff) |
Replaced unsafe strcpy() calls
-rw-r--r-- | FICS/obsproc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c index 603c684..0ab6fcb 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -769,8 +769,8 @@ ExamineScratch(int p, param_list param) if (param[0].val.string != parray[p].name && param[1].type == TYPE_WORD) { - strcpy(category, param[0].val.string); - strcpy(board, param[1].val.string); + mstrlcpy(category, param[0].val.string, sizeof category); + mstrlcpy(board, param[1].val.string, sizeof board); } else if (param[1].type != TYPE_NULL) { val = param[1].val.string; @@ -778,13 +778,13 @@ ExamineScratch(int p, param_list param) val = eatword(eatwhite(val)); if (category[0] != '\0' && board[0] == '\0') { - strcpy(board, parsebuf); + mstrlcpy(board, parsebuf, sizeof board); } else if (isdigit(*parsebuf)) { pprintf(p, "You can't specify time controls." "\n"); return; } else if (category[0] == '\0') { - strcpy(category, parsebuf); + mstrlcpy(category, parsebuf, sizeof category); } else { confused = 1; } @@ -816,9 +816,12 @@ ExamineScratch(int p, param_list param) } garray[g].game_state.gameNum = g; - strcpy(garray[g].white_name, parray[p].name); - strcpy(garray[g].black_name, parray[p].name); - garray[g].white_rating = garray[g].black_rating = parray[p].s_stats.rating; + mstrlcpy(garray[g].white_name, parray[p].name, + sizeof(garray[g].white_name)); + mstrlcpy(garray[g].black_name, parray[p].name, + sizeof(garray[g].black_name)); + garray[g].white_rating = garray[g].black_rating = + parray[p].s_stats.rating; send_boards(g); MakeFENpos(g, (char *)garray[g].FENstartPos); } |