]> wagner.pp.ru Git - oss/catdoc.git/commitdiff
Fix bug introduced when fixed segfaults, found by CLang analyzer
authorVictor Wagner <vitus@wagner.pp.ru>
Tue, 26 Apr 2016 17:29:46 +0000 (20:29 +0300)
committerVictor Wagner <vitus@wagner.pp.ru>
Tue, 26 Apr 2016 17:29:46 +0000 (20:29 +0300)
src/ole.c

index 1e26dd797a190d98712ddce6d5a1927471bfae3c..e131a0dac2140921121edfeda7c65dc14fa3ffca 100644 (file)
--- 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;