Browse code

Bug 396

git-svn: trunk@2926

Nigel Horne authored on 2007/03/10 07:39:06
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Mar  9 20:45:08 GMT 2007 (njh)
2
+----------------------------------
3
+  * libclamav/pdf.c:	Bug 396
4
+
1 5
 Fri Mar  9 21:02:31 CET 2007 (tk)
2 6
 ---------------------------------
3 7
   * libclamav/lockdb.c: fix fd leak on EACCES/EAGAIN (bb#400)
... ...
@@ -55,7 +55,7 @@ static	char	const	rcsid[] = "$Id: pdf.c,v 1.61 2007/02/12 20:46:09 njh Exp $";
55 55
 #include "pdf.h"
56 56
 
57 57
 #ifdef	CL_DEBUG
58
-/*#define	SAVE_TMP	/* Save the file being worked on in tmp */
58
+#define	SAVE_TMP	/* Save the file being worked on in tmp */
59 59
 #endif
60 60
 
61 61
 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)
355 355
 		 * Calculate the length ourself, the Length parameter is often
356 356
 		 * wrong
357 357
 		 */
358
-		while(strchr("\r\n", *--streamend))
359
-			;
358
+		if(*--streamend != '\n')
359
+			streamend++;
360
+		else if(*--streamend != '\r')
361
+			streamend++;
360 362
 
361 363
 		if(streamend <= streamstart) {
362 364
 			cli_dbgmsg("Empty stream\n");
... ...
@@ -495,6 +497,8 @@ flatedecode(unsigned char *buf, off_t len, int fout, const cli_ctx *ctx)
495 495
 		if(tmpfp) {
496 496
 			fwrite(buf, sizeof(char), len, tmpfp);
497 497
 			fclose(tmpfp);
498
+			cli_dbgmsg("cli_pdf: flatedecode: debugging file is %s\n",
499
+				tmpfilename);
498 500
 		} else
499 501
 			cli_errmsg("cli_pdf: can't fdopen debugging file\n");
500 502
 	}