]> Devoid-pointer.net GitWeb - libHPCS.git/commitdiff
Fix return value check from fread
authorMichal Malý <madcatxster@devoid-pointer.net>
Thu, 18 Aug 2016 15:08:13 +0000 (17:08 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Thu, 18 Aug 2016 15:08:13 +0000 (17:08 +0200)
libhpcs.c

index 827ac5d480c57c20d8bea4f12e8c8757136a88ee..c660971e33b38fc9f612d0dd87a7eecbd132428a 100644 (file)
--- a/libhpcs.c
+++ b/libhpcs.c
@@ -905,14 +905,14 @@ static enum HPCS_ParseCode read_generic_type(FILE* datafile, enum HPCS_GenType*
        if (ferror(datafile))
                return PARSE_E_CANT_READ;
 
-       if (fread(&len, SMALL_SEGMENT_SIZE, 1, datafile) < SMALL_SEGMENT_SIZE)
+       if (fread(&len, SMALL_SEGMENT_SIZE, 1, datafile) < 1)
                return PARSE_E_CANT_READ;
 
        gentype_str = malloc((sizeof(char) * len) + 1);
        if (gentype_str == NULL)
                return PARSE_E_NO_MEM;
 
-       if (fread(gentype_str, SMALL_SEGMENT_SIZE, len, datafile) < SMALL_SEGMENT_SIZE * len) {
+       if (fread(gentype_str, SMALL_SEGMENT_SIZE, len, datafile) < len) {
                ret = PARSE_E_CANT_READ;
                goto out;
        }