From: Victor Wagner Date: Tue, 26 Apr 2016 17:29:46 +0000 (+0300) Subject: Fix bug introduced when fixed segfaults, found by CLang analyzer X-Git-Tag: REL_0_95~6^2 X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=oss%2Fcatdoc.git;a=commitdiff_plain;h=d9cb3fb664ac9f9684eaa76e916c90d1516855bc Fix bug introduced when fixed segfaults, found by CLang analyzer --- diff --git a/src/ole.c b/src/ole.c index 1e26dd7..e131a0d 100644 --- a/src/ole.c +++ b/src/ole.c @@ -125,7 +125,11 @@ FILE* ole_init(FILE *f, void *buffer, size_t bufSize) { memcpy(tmpBuf,oleBuf+0x4c,MSAT_ORIG_SIZE); mblock=getlong(oleBuf,0x44); msat_size=getlong(oleBuf,0x48); - if (msat_size * sectorSize) + if (msat_size * sectorSize > fileLength) { + free(tmpBuf); + return NULL; + } + /* fprintf(stderr, "msat_size=%ld\n", msat_size); */ i=0;