]> Devoid-pointer.net GitWeb - libHPCS.git/commitdiff
Add missing check of fread() return value
authorMichal Malý <madcatxster@gmail.com>
Sun, 23 Oct 2016 19:07:28 +0000 (21:07 +0200)
committerMichal Malý <madcatxster@gmail.com>
Sun, 23 Oct 2016 19:07:28 +0000 (21:07 +0200)
libhpcs.c

index 9b1ab0a47cabf7a51d92646c4a03f9833b58c983..881fcddddb0f49812f4dda77ca5e8b641c66b342 100644 (file)
--- a/libhpcs.c
+++ b/libhpcs.c
@@ -1021,8 +1021,8 @@ static enum HPCS_ParseCode read_signal(FILE* datafile, struct HPCS_TVPair** pair
                                int32_t _v;
 
                                PR_DEBUGF("Value has jumped at 0x%lx\n", segments_read);
-                               fread(lraw, LARGE_SEGMENT_SIZE, 1, datafile);
-                               if (feof(datafile) || ferror(datafile)) {
+                               r = fread(lraw, LARGE_SEGMENT_SIZE, 1, datafile);
+                               if (feof(datafile) || ferror(datafile) || (r != 1)) {
                                        free(*pairs);
                                        *pairs = NULL;
                                        return PARSE_E_CANT_READ;