git-svn: trunk@1547
Nigel Horne authored on 2005/05/15 01:16:08... | ... |
@@ -1,3 +1,9 @@ |
1 |
+Sat May 14 17:14:52 BST 2005 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/pdf.c: Fix problem with munmap not unmapping all the area, |
|
4 |
+ thanks to Martin Blapp <mb at imp.ch> for |
|
5 |
+ pointing this out |
|
6 |
+ |
|
1 | 7 |
Thu May 12 09:23:52 BST 2005 (trog) |
2 | 8 |
----------------------------------- |
3 | 9 |
* libclamav/speical.c: Fix reading PString type in Photoshop thumbnails. |
... | ... |
@@ -5,7 +11,7 @@ Thu May 12 09:23:52 BST 2005 (trog) |
5 | 5 |
Thu May 12 08:32:22 BST 2005 (njh) |
6 | 6 |
---------------------------------- |
7 | 7 |
* clamav-milter: Open /dev/console (if LogFile not set) before |
8 |
- dropping priv so that error messages aren't |
|
8 |
+ dropping priv so that error messages aren't |
|
9 | 9 |
lost reported by David Crow. |
10 | 10 |
|
11 | 11 |
Wed May 11 18:02:24 CEST 2005 (tk) |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: binhex.c,v $ |
20 |
+ * Revision 1.16 2005/05/14 16:13:25 nigelhorne |
|
21 |
+ * Ensure munmap is the right size |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.15 2005/05/13 19:30:34 nigelhorne |
21 | 24 |
* Clean cli_realloc call |
22 | 25 |
* |
... | ... |
@@ -60,7 +63,7 @@ |
60 | 60 |
* First draft of binhex.c |
61 | 61 |
* |
62 | 62 |
*/ |
63 |
-static char const rcsid[] = "$Id: binhex.c,v 1.15 2005/05/13 19:30:34 nigelhorne Exp $"; |
|
63 |
+static char const rcsid[] = "$Id: binhex.c,v 1.16 2005/05/14 16:13:25 nigelhorne Exp $"; |
|
64 | 64 |
|
65 | 65 |
#include "clamav.h" |
66 | 66 |
|
... | ... |
@@ -131,7 +134,7 @@ cli_binhex(const char *dir, int desc) |
131 | 131 |
|
132 | 132 |
cli_dbgmsg("mmap'ed binhex file\n"); |
133 | 133 |
|
134 |
- bytesleft = (int)size; |
|
134 |
+ bytesleft = (long)size; |
|
135 | 135 |
line = NULL; |
136 | 136 |
|
137 | 137 |
while(bytesleft > 0) { |
... | ... |
@@ -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.8 2005/05/13 09:56:00 nigelhorne Exp $"; |
|
18 |
+static char const rcsid[] = "$Id: pdf.c,v 1.9 2005/05/14 16:13:25 nigelhorne Exp $"; |
|
19 | 19 |
|
20 | 20 |
#if HAVE_CONFIG_H |
21 | 21 |
#include "clamav-config.h" |
... | ... |
@@ -63,6 +63,7 @@ cli_pdf(const char *dir, int desc) |
63 | 63 |
#else |
64 | 64 |
struct stat statb; |
65 | 65 |
off_t size; |
66 |
+ long bytesleft; |
|
66 | 67 |
char *buf; |
67 | 68 |
const char *p, *q; |
68 | 69 |
|
... | ... |
@@ -80,7 +81,8 @@ cli_pdf(const char *dir, int desc) |
80 | 80 |
if(buf == MAP_FAILED) |
81 | 81 |
return CL_EMEM; |
82 | 82 |
|
83 |
- while((q = cli_pmemstr(p, size, "obj", 3)) != NULL) { |
|
83 |
+ bytesleft = (long)size; |
|
84 |
+ while((q = cli_pmemstr(p, bytesleft, "obj", 3)) != NULL) { |
|
84 | 85 |
int length, flatedecode; |
85 | 86 |
const char *s, *t; |
86 | 87 |
const char *u, *obj; |
... | ... |
@@ -88,14 +90,14 @@ cli_pdf(const char *dir, int desc) |
88 | 88 |
int fout; |
89 | 89 |
char fullname[NAME_MAX + 1]; |
90 | 90 |
|
91 |
- size -= (q - p) + 3; |
|
91 |
+ bytesleft -= (q - p) + 3; |
|
92 | 92 |
obj = p = &q[3]; |
93 |
- q = cli_pmemstr(p, size, "endobj", 6); |
|
93 |
+ q = cli_pmemstr(p, bytesleft, "endobj", 6); |
|
94 | 94 |
if(q == NULL) { |
95 | 95 |
cli_dbgmsg("No matching endobj"); |
96 | 96 |
break; |
97 | 97 |
} |
98 |
- size -= (q - p) + 6; |
|
98 |
+ bytesleft -= (q - p) + 6; |
|
99 | 99 |
p = &q[6]; |
100 | 100 |
objlen = (size_t)(q - obj); |
101 | 101 |
|