Browse code

libclamav/cab.c: handle MSZIP compressed files with large block sizes (bb#1085)

git-svn: trunk@4978

Tomasz Kojm authored on 2009/03/23 22:01:02
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Mon Mar 23 13:59:28 CET 2009 (tk)
2
+---------------------------------
3
+ * libclamav/cab.c: handle MSZIP compressed files with large block sizes
4
+		    (bb#1085)
5
+
1 6
 Mon Mar 23 13:52:31 CET 2009 (tk)
2 7
 ---------------------------------
3 8
  * libclamunrar, libclamav: don't depend on the uncompressed size field
... ...
@@ -539,10 +539,10 @@ static int cab_read(struct cab_file *file, unsigned char *buffer, int bytes)
539 539
 
540 540
 	    if(file->cab->state->blknum >= file->folder->nblocks) {
541 541
 		if((file->folder->cmethod & 0x000f) == 0x0003) { /* LZX hack */
542
-		    lzx_set_output_length(file->cab->state->stream, (off_t) ((file->cab->state->blknum - 1) * CAB_BLOCKMAX + file->cab->state->outlen));
542
+		    lzx_set_output_length(file->cab->state->stream, (off_t) ((file->cab->state->blknum - 1) * 32768 + file->cab->state->outlen));
543 543
 		}
544 544
 	    } else {
545
-		if(file->cab->state->outlen != CAB_BLOCKMAX) {
545
+		if(file->cab->state->outlen != 32768) {
546 546
 		    cli_dbgmsg("cab_read: WARNING: partial data block\n");
547 547
 		}
548 548
 	    }
... ...
@@ -24,7 +24,7 @@
24 24
 #include <sys/types.h>
25 25
 #include "cltypes.h"
26 26
 
27
-#define CAB_BLOCKMAX 32768
27
+#define CAB_BLOCKMAX 65535
28 28
 #define CAB_INPUTMAX (CAB_BLOCKMAX + 6144)
29 29
 
30 30
 struct cab_archive {