]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
netem/maketable: Check return value of fscanf()
authorPhil Sutter <phil@nwl.cc>
Thu, 24 Aug 2017 09:41:28 +0000 (11:41 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 24 Aug 2017 22:22:10 +0000 (15:22 -0700)
Signed-off-by: Phil Sutter <phil@nwl.cc>
netem/maketable.c

index ad660e7d457f058bf1a2fbbe23accd549611bfba..ccb8f0c68b062002f98a6592b170e726160c7740 100644 (file)
@@ -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;
        }