diff --git a/ChangeLog b/ChangeLog index 7a2e42f17..b02631b15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Mar 9 20:45:08 GMT 2007 (njh) +---------------------------------- + * libclamav/pdf.c: Bug 396 + Fri Mar 9 21:02:31 CET 2007 (tk) --------------------------------- * libclamav/lockdb.c: fix fd leak on EACCES/EAGAIN (bb#400) diff --git a/libclamav/pdf.c b/libclamav/pdf.c index cde3eeca5..1cad8c533 100644 --- a/libclamav/pdf.c +++ b/libclamav/pdf.c @@ -55,7 +55,7 @@ static char const rcsid[] = "$Id: pdf.c,v 1.61 2007/02/12 20:46:09 njh Exp $"; #include "pdf.h" #ifdef CL_DEBUG -/*#define SAVE_TMP /* Save the file being worked on in tmp */ +#define SAVE_TMP /* Save the file being worked on in tmp */ #endif static int try_flatedecode(unsigned char *buf, off_t real_len, off_t calculated_len, int fout, const cli_ctx *ctx); @@ -355,8 +355,10 @@ cli_pdf(const char *dir, int desc, const cli_ctx *ctx) * Calculate the length ourself, the Length parameter is often * wrong */ - while(strchr("\r\n", *--streamend)) - ; + if(*--streamend != '\n') + streamend++; + else if(*--streamend != '\r') + streamend++; if(streamend <= streamstart) { cli_dbgmsg("Empty stream\n"); @@ -495,6 +497,8 @@ flatedecode(unsigned char *buf, off_t len, int fout, const cli_ctx *ctx) if(tmpfp) { fwrite(buf, sizeof(char), len, tmpfp); fclose(tmpfp); + cli_dbgmsg("cli_pdf: flatedecode: debugging file is %s\n", + tmpfilename); } else cli_errmsg("cli_pdf: can't fdopen debugging file\n"); }