Browse code

Ignore NL at start of FlateDecode section

git-svn: trunk@1559

Nigel Horne authored on 2005/05/20 17:16:36
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri May 20 09:16:36 BST 2005 (njh)
2
+----------------------------------
3
+  * libclamav/pdf.c:	Ignore leading NL in FlateDecode messages
4
+
1 5
 Thu May 19 10:33:52 BST 2005 (njh)
2 6
 ----------------------------------
3 7
   * clamav-milter:	Used some of sendmail V8.13's features for sanity
... ...
@@ -15,7 +15,7 @@
15 15
  *  along with this program; if not, write to the Free Software
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  */
18
-static	char	const	rcsid[] = "$Id: pdf.c,v 1.11 2005/05/19 10:17:39 nigelhorne Exp $";
18
+static	char	const	rcsid[] = "$Id: pdf.c,v 1.12 2005/05/20 08:14:34 nigelhorne Exp $";
19 19
 
20 20
 #if HAVE_CONFIG_H
21 21
 #include "clamav-config.h"
... ...
@@ -144,8 +144,8 @@ cli_pdf(const char *dir, int desc)
144 144
 
145 145
 		if(fout < 0) {
146 146
 			cli_errmsg("cli_pdf: can't create temporary file %s: %s\n", fullname, strerror(errno));
147
-			munmap(buf, size);
148
-			return CL_ETMPFILE;
147
+			rc = CL_ETMPFILE;
148
+			break;
149 149
 		}
150 150
 
151 151
 		if(flatedecode) {
... ...
@@ -155,6 +155,11 @@ cli_pdf(const char *dir, int desc)
155 155
 
156 156
 			cli_dbgmsg("cli_pdf: flatedecode %lu bytes\n", len);
157 157
 
158
+			if(strchr("\r\n", *t)) {
159
+				len--;
160
+				t++;
161
+			}
162
+
158 163
 			stream.zalloc = (alloc_func)Z_NULL;
159 164
 			stream.zfree = (free_func)Z_NULL;
160 165
 			stream.opaque = (void *)NULL;
... ...
@@ -205,7 +210,7 @@ cli_pdf(const char *dir, int desc)
205 205
 
206 206
 	munmap(buf, size);
207 207
 
208
-	cli_dbgmsg("cli_pdf: returning CL_CLEAN\n");
208
+	cli_dbgmsg("cli_pdf: returning %d\n", rc);
209 209
 	return rc;
210 210
 #endif
211 211
 }