diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-11-26 23:38:39 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-11-26 23:38:39 +0100 |
commit | 81920970de9d4c5f5b39bfacb27d812c73d5d7c4 (patch) | |
tree | 343fc11453cb52b654b12657fbc73c3cc4bade70 | |
parent | e5e5f1fb1a53108717256ec8b5199341b82030b0 (diff) |
DisplayRank: check the return of sscanf()
-rw-r--r-- | FICS/ratings.c | 9 |
1 files changed, 8 insertions, 1 deletions
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); |