From a5b487dfe4b4b065a6cde35f9385926719478c91 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Mon, 2 Dec 2024 20:54:10 +0100 Subject: WriteMoves: fixed possible array underrun --- FICS/gamedb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'FICS') 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; -- cgit v1.2.3