diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-05-20 00:36:42 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-05-20 00:36:42 +0200 |
commit | c11aba939e5429b7138424231396170873a11259 (patch) | |
tree | 1f8b73fd3a5891805dced8179de4746df9e9228e /FICS/gamedb.c | |
parent | 679bf294d1a0924d7783ab6748f1ff327200373b (diff) |
Size-bounded concatenation
Diffstat (limited to 'FICS/gamedb.c')
-rw-r--r-- | FICS/gamedb.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c index 7b1d44e..55330cb 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -1127,14 +1127,19 @@ ReadOneV1Move(FILE *fp, move_t *m) } if (m->piecePromotionTo != 0) { - if (m->piecePromotionTo == KNIGHT) - strcat(m->algString, "=N"); - else if (m->piecePromotionTo == BISHOP) - strcat(m->algString, "=B"); - else if (m->piecePromotionTo == ROOK) - strcat(m->algString, "=R"); - else if (m->piecePromotionTo == QUEEN) - strcat(m->algString, "=Q"); + if (m->piecePromotionTo == KNIGHT) { + mstrlcat(m->algString, "=N", + sizeof(m->algString)); + } else if (m->piecePromotionTo == BISHOP) { + mstrlcat(m->algString, "=B", + sizeof(m->algString)); + } else if (m->piecePromotionTo == ROOK) { + mstrlcat(m->algString, "=R", + sizeof(m->algString)); + } else if (m->piecePromotionTo == QUEEN) { + mstrlcat(m->algString, "=Q", + sizeof(m->algString)); + } m->piecePromotionTo |= m->color; } @@ -1189,7 +1194,7 @@ ReadOneV1Move(FILE *fp, move_t *m) } } if (check) - strcat(m->algString, "+"); + mstrlcat(m->algString, "+", sizeof m->algString); } PRIVATE int |