aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-01-04 00:12:00 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-01-04 00:12:00 +0100
commit700d6e0c5ae656db02d1fa52a9f892f0f180fdda (patch)
tree450d00eba236708fdeeaad883a0594f182bed15c
parentc1f1fa04ed1c754fb6343292218a2fcce79f9c0f (diff)
Check the return of sscanf()
-rw-r--r--FICS/comproc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/FICS/comproc.c b/FICS/comproc.c
index 5bd1eba..c48c068 100644
--- a/FICS/comproc.c
+++ b/FICS/comproc.c
@@ -113,12 +113,10 @@ rscan_news2(FILE *fp, int p, int num)
if (num == 0)
return;
- ;
-
- if (fgets(junk, sizeof junk, fp) == NULL || feof(fp))
+ if (fgets(junk, sizeof junk, fp) == NULL || feof(fp) ||
+ sscanf(junk, "%ld %9s", &lval, count) != 2)
return;
- sscanf(junk, "%ld %s", &lval, count);
rscan_news2(fp, p, num - 1);
junkp = junk;