aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
Diffstat (limited to 'FICS')
-rw-r--r--FICS/ratings.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c
index f8cc424..446a88d 100644
--- a/FICS/ratings.c
+++ b/FICS/ratings.c
@@ -1498,19 +1498,46 @@ CompareStats(char *name1, statistics *s1,
PRIVATE int
GetRankFileName(char *out, const size_t size, int type)
{
+ int ret;
+
+ if (out == NULL) {
+ warnx("%s: invalid arg: null pointer detected", __func__);
+ return -1;
+ }
+
switch (type) {
case TYPE_BLITZ:
- snprintf(out, size, "%s/rank.blitz", sdir);
+ ret = snprintf(out, size, "%s/rank.blitz", sdir);
+
+ if (is_too_long(ret, size)) {
+ warnx("%s: snprintf: truncated", __func__);
+ return -1;
+ }
+
return type;
case TYPE_STAND:
- snprintf(out, size, "%s/rank.std", sdir);
+ ret = snprintf(out, size, "%s/rank.std", sdir);
+
+ if (is_too_long(ret, size)) {
+ warnx("%s: snprintf: truncated", __func__);
+ return -1;
+ }
+
return type;
case TYPE_WILD:
- snprintf(out, size, "%s/rank.wild", sdir);
+ ret = snprintf(out, size, "%s/rank.wild", sdir);
+
+ if (is_too_long(ret, size)) {
+ warnx("%s: snprintf: truncated", __func__);
+ return -1;
+ }
+
return type;
default:
- return -1;
+ break;
}
+
+ return -1;
}
PUBLIC void