From b370d40b9ebabdfe3270df01ad7506d01cfc5d95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Sun, 23 Oct 2016 21:07:28 +0200 Subject: [PATCH] Add missing check of fread() return value --- libhpcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.43.5