Browse code

libclamav/chmunpack.c: fix possible invalid memory access (bb#1089)

git-svn: trunk@4157

Tomasz Kojm authored on 2008/09/02 02:28:17
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Mon Sep  1 19:27:55 CEST 2008 (tk)
2
+----------------------------------
3
+  * libclamav/chmunpack.c: fix possible invalid memory access (bb#1089)
4
+			   Patch from Trog
5
+
1 6
 Mon Sep  1 10:57:56 EEST 2008 (edwin)
2 7
 ------------------------------------ 
3 8
   * libclamav/scanners.c: enable scanscript for UTF* types too
... ...
@@ -449,7 +449,7 @@ static int read_chunk(chm_metadata_t *metadata, int fd)
449 449
 	cli_dbgmsg("in read_chunk\n");
450 450
 
451 451
 	if (metadata->itsp_hdr.block_len < 8 || metadata->itsp_hdr.block_len > 33554432) {
452
-		return FALSE;
452
+		return CL_EFORMAT;
453 453
 	}
454 454
 
455 455
 	if (metadata->m_area != NULL) {
... ...
@@ -915,7 +915,9 @@ int cli_chm_open(int fd, const char *dirname, chm_metadata_t *metadata)
915 915
 			cli_dbgmsg("read_chunk failed");
916 916
 			goto abort;
917 917
 		}
918
-		read_control_entries(metadata);
918
+		if (read_control_entries(metadata) == FALSE) {
919
+			goto abort;
920
+		}
919 921
 		metadata->num_chunks--;
920 922
 		metadata->chunk_offset += metadata->itsp_hdr.block_len;
921 923
 	}