aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--FICS/playerdb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index 309a8fc..d1a08e5 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -409,10 +409,14 @@ add_to_list(FILE *fp, enum ListWhich lw, int *size, int p)
#define SCAN_STR "%1023s"
- if (*size <= 0)
- return -2;
+ if (*size <= 0 || *size > MAX_GLOBAL_LIST_SIZE) {
+ warnx("%s: illegal list size (%d)", __func__, *size);
+ return -1;
+ }
+
while ((*size)-- > 0 && fscanf(fp, SCAN_STR, buf) == 1)
list_add(p, lw, buf);
+
return (*size <= 0 ? 0 : -1);
}