From 81920970de9d4c5f5b39bfacb27d812c73d5d7c4 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Tue, 26 Nov 2024 23:38:39 +0100 Subject: DisplayRank: check the return of sscanf() --- FICS/ratings.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'FICS/ratings.c') diff --git a/FICS/ratings.c b/FICS/ratings.c index 3cd8d85..2839bd5 100644 --- a/FICS/ratings.c +++ b/FICS/ratings.c @@ -1339,8 +1339,15 @@ DisplayRank(int p, param_list param, int showComputers) DisplayTargetRank(p, parray[p].name, show, showComputers); return COM_OK; } else if (isdigit(param[0].val.word[0])) { + int ret; + end = -1; - sscanf(param[0].val.word, "%d-%d", &start, &end); + ret = sscanf(param[0].val.word, "%d-%d", &start, &end); + + if (ret != 2) { + warnx("%s: sscanf() == %d", __func__, ret); + return COM_FAILED; + } if (end > 0 && (param[1].type != TYPE_NULL)) show = ShowFromString(param[1].val.word); -- cgit v1.2.3