aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-08-04 01:20:11 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-08-04 01:20:11 +0200
commit5c93024d1953ee5d0f060dd3bfa59b409e7f31ac (patch)
tree17d2e44fe729966b99ce4bc07f2bdf6c4e65a992 /FICS
parentb66b6d954ba6434e113fe6263682ae476252c41d (diff)
Bounds checking
Diffstat (limited to 'FICS')
-rw-r--r--FICS/playerdb.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index 79067ae..15959b5 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -1512,8 +1512,13 @@ player_lastconnect(int p)
if (inout == P_LOGIN)
last = lval;
- if (fscanf(fp, "%d %s %ld %d %s\n", &inout, loginName, &lval,
- &registered, ipstr) != 5) {
+ _Static_assert(19 < ARRAY_SIZE(loginName),
+ "'loginName' too small");
+ _Static_assert(19 < ARRAY_SIZE(ipstr),
+ "'ipstr' too small");
+
+ if (fscanf(fp, "%d %19s %ld %d %19s\n", &inout, loginName,
+ &lval, &registered, ipstr) != 5) {
fprintf(stderr, "FICS: Error in login info format. %s"
"\n", fname);
fclose(fp);