From d9cb3fb664ac9f9684eaa76e916c90d1516855bc Mon Sep 17 00:00:00 2001 From: Victor Wagner Date: Tue, 26 Apr 2016 20:29:46 +0300 Subject: [PATCH] Fix bug introduced when fixed segfaults, found by CLang analyzer --- src/ole.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- 2.39.5