aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-12-02 20:54:10 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-12-02 20:54:10 +0100
commita5b487dfe4b4b065a6cde35f9385926719478c91 (patch)
tree1f57cc37ef997325b7b8b7bd5772ed26d309febe
parent160c816f2b1b6c62207f74670cd3ce822d08a4dc (diff)
WriteMoves: fixed possible array underrun
-rw-r--r--FICS/gamedb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c
index 530eb47..572abf5 100644
--- a/FICS/gamedb.c
+++ b/FICS/gamedb.c
@@ -886,7 +886,8 @@ WriteMoves(FILE *fp, move_t *m)
/* Are we using from-file or from-rank in 'algString'? */
- i = strlen(m->algString) - 1;
+ if ((i = strlen(m->algString)) > 0)
+ i -= 1;
if (m->algString[i] == '+') {
check = 1;