[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170824094131.2963-4-phil@nwl.cc>
Date: Thu, 24 Aug 2017 11:41:28 +0200
From: Phil Sutter <phil@....cc>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: [iproute PATCH v3 3/6] netem/maketable: Check return value of fscanf()
Signed-off-by: Phil Sutter <phil@....cc>
---
netem/maketable.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/netem/maketable.c b/netem/maketable.c
index ad660e7d457f0..ccb8f0c68b062 100644
--- a/netem/maketable.c
+++ b/netem/maketable.c
@@ -38,8 +38,8 @@ readdoubles(FILE *fp, int *number)
}
for (i=0; i<limit; ++i){
- fscanf(fp, "%lf", &x[i]);
- if (feof(fp))
+ if (fscanf(fp, "%lf", &x[i]) != 1 ||
+ feof(fp))
break;
++n;
}
--
2.13.1
Powered by blists - more mailing lists