Browse code

some cab archives were not properly decompressed

git-svn: trunk@1660

Tomasz Kojm authored on 2005/07/20 10:55:58
Showing 4 changed files
... ...
@@ -1,3 +1,8 @@
1
+Wed Jul 20 03:41:00 CEST 2005 (tk)
2
+----------------------------------
3
+  * libclamav/mspack: some cab archives were not properly decompressed (problem
4
+		      reported by Diego d'Ambra <diego*clamav.net>)
5
+
1 6
 Tue Jul 19 22:35:02 CEST 2005 (tk)
2 7
 ----------------------------------
3 8
   * libclamav/pe.c: cli_peheader: sync entry point calculation with cli_scanpe
... ...
@@ -1264,7 +1264,7 @@ static int cabd_sys_read(struct mspack_file *file, void *buffer, int bytes) {
1264 1264
       /* check if we're out of input blocks, advance block counter */
1265 1265
       if (this->d->block++ >= this->d->folder->base.num_blocks) {
1266 1266
 	this->error = MSPACK_ERR_DATAFORMAT;
1267
-	return -1;
1267
+	break;
1268 1268
       }
1269 1269
 
1270 1270
       /* read a block */
... ...
@@ -95,7 +95,7 @@ static const unsigned short bit_mask[17] = {
95 95
 
96 96
 static int zipd_read_input(struct mszipd_stream *zip) {
97 97
   int read = zip->sys->read(zip->input, &zip->inbuf[0], (int)zip->inbuf_size);
98
-  if (read < 0) return zip->error = MSPACK_ERR_READ;
98
+  if (read <= 0) return zip->error = MSPACK_ERR_READ;
99 99
   zip->i_ptr = &zip->inbuf[0];
100 100
   zip->i_end = &zip->inbuf[read];
101 101
 
... ...
@@ -15,7 +15,7 @@
15 15
 # define D(x) do { printf("%s:%d (%s) ",__FILE__, __LINE__, __FUNCTION__); \
16 16
                    printf x ; fputc('\n', stdout); fflush(stdout);} while (0);
17 17
 #else
18
-# define D(x)
18
+# define D(x) cli_dbgmsg x ;
19 19
 #endif
20 20
 
21 21
 /* endian-neutral reading of little-endian data */