diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-12-02 20:54:10 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-12-02 20:54:10 +0100 |
commit | a5b487dfe4b4b065a6cde35f9385926719478c91 (patch) | |
tree | 1f57cc37ef997325b7b8b7bd5772ed26d309febe /FICS/gamedb.c | |
parent | 160c816f2b1b6c62207f74670cd3ce822d08a4dc (diff) |
WriteMoves: fixed possible array underrun
Diffstat (limited to 'FICS/gamedb.c')
-rw-r--r-- | FICS/gamedb.c | 3 |
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; |