From: Michal MalĂ˝ Date: Sun, 23 Oct 2016 19:07:28 +0000 (+0200) Subject: Add missing check of fread() return value X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=b370d40b9ebabdfe3270df01ad7506d01cfc5d95;p=libHPCS.git Add missing check of fread() return value --- diff --git a/libhpcs.c b/libhpcs.c index 9b1ab0a..881fcdd 100644 --- 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;