From b03c910dc2238a78e30517b5d3e253e697c2e4b6 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 27 Jun 2018 18:09:12 -0400 Subject: [PATCH] wmifs: Error handling when fopen fails. This prevents fgets from segfaulting on the next line, closing Debian bug #901353. Thanks to for the bug report and patch. --- wmifs/wmifs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wmifs/wmifs.c b/wmifs/wmifs.c index ab91f23..460c045 100644 --- a/wmifs/wmifs.c +++ b/wmifs/wmifs.c @@ -764,6 +764,8 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os) /* Read from /proc/net/dev the stats! */ fp = fopen("/proc/net/dev", "r"); + if (!fp) + return -1 if (!fgets(temp, BUFFER_SIZE, fp)) { fclose(fp); return -1; -- 2.11.4.GIT