Ensure read_long() reads the correct number of bytes from the index
authorLeandro Pereira <leandro@hardinfo.org>
Mon, 28 Apr 2014 23:47:49 +0000 (20:47 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 14 May 2014 23:18:00 +0000 (20:18 -0300)
libkmod/libkmod-index.c

index 2136a96..0c49868 100644 (file)
@@ -126,7 +126,7 @@ static uint32_t read_long(FILE *in)
        uint32_t l;
 
        errno = 0;
-       if (fread(&l, sizeof(uint32_t), 1, in) <= 0)
+       if (fread(&l, sizeof(uint32_t), 1, in) != sizeof(uint32_t))
                read_error();
        return ntohl(l);
 }