X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fole.c;h=d1c731ddf8a309127428d168096e1ec38c1fba7f;hb=7de410970cd2916482178d730b64aef013b0567a;hp=ff21a30e587c4d5f735fec4ba548b07ced0c1d46;hpb=51f0f8ed69b065cd2577a27c2a2911cdda243b99;p=oss%2Fcatdoc.git diff --git a/src/ole.c b/src/ole.c index ff21a30..d1c731d 100644 --- a/src/ole.c +++ b/src/ole.c @@ -2,7 +2,7 @@ * @file ole.c * @author Alex Ott, Victor B Wagner * @date Wed Jun 11 12:33:01 2003 - * Version: $Id: ole.c,v 1.1 2006-02-24 17:44:06 vitus Exp $ + * Version: $Id: ole.c,v 1.2 2006-02-25 15:28:14 vitus Exp $ * Copyright: Victor B Wagner, 1996-2003 Alex Ott, 2003 * * @brief Parsing structure of MS Office compound document @@ -37,7 +37,7 @@ long propCurNumber, propLen, propNumber, propStart; unsigned char *properties=NULL; long int fileLength=0; -static unsigned char ole_sign[]={0xD0,0xCF,0x11,0xE0,0xA1,0xB1,0x1A,0xE1,0}; +static char ole_sign[]={0xD0,0xCF,0x11,0xE0,0xA1,0xB1,0x1A,0xE1,0}; /** @@ -97,7 +97,7 @@ FILE* ole_init(FILE *f, void *buffer, size_t bufSize) { if ( ret != BBD_BLOCK_SIZE ) { return NULL; } - if (strncmp(oleBuf,ole_sign,8) != 0) { + if (strncmp((char *)&oleBuf,ole_sign,8) != 0) { return NULL; } sectorSize = 1<name[0]||strcmp(tEntry->name,"Root Entry") == 0) { + if (tEntry->type == oleRootDir ) { rootEntry=tEntry; break; } @@ -252,8 +252,7 @@ FILE* ole_init(FILE *f, void *buffer, size_t bufSize) { propCurNumber = 0; fseek(newfile, 0, SEEK_SET); if (!rootEntry) { - fprintf(stderr,"Cannot find root entry in this file!\n"); - ole_finish(); + fprintf(stderr,"Broken OLE structure. Cannot find root entry in this file!\n"); ole_finish(); return NULL; } return newfile; @@ -329,6 +328,7 @@ FILE *ole_readdir(FILE *f) { (e->startBlock <= fileLength/(e->isBigBlock ? sectorSize : shortSectorSize))) { if((e->blocks=malloc(chainMaxLen*sizeof(long int))) == NULL ) { + free(e); return NULL; } while(1) {