[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Tomasz Kojm tkojm at clamav.net
Sun Apr 4 01:13:22 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit ec616ce0c57a1424361ebceb4530297151e540f5
Author: Tomasz Kojm <tkojm at clamav.net>
Date:   Mon Jan 4 15:35:52 2010 +0100

    libclamav: fix error reporting for BinHex files (bb#1685)

diff --git a/ChangeLog b/ChangeLog
index 7474182..c4d6099 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Jan  4 15:35:16 CET 2010 (tk)
+---------------------------------
+ * libclamav: fix error reporting for BinHex files (bb#1685)
+
 Wed Dec 30 00:19:21 CET 2009 (tk)
 ---------------------------------
  * libclamav: add support for FileSize, EntryPoint and NumberOfSections in
diff --git a/libclamav/binhex.c b/libclamav/binhex.c
index 705f683..30d0108 100644
--- a/libclamav/binhex.c
+++ b/libclamav/binhex.c
@@ -120,6 +120,7 @@ cli_binhex(const char *dir, fmap_t *map)
 	long bytesleft;
 	message *m;
 	fileblob *fb;
+	text *t_line;
 
 	size = (size_t)map->len;
 
@@ -179,12 +180,20 @@ cli_binhex(const char *dir, fmap_t *map)
 	if(line)
 		free(line);
 
-	if(binhexBegin(m) == NULL) {
+	if((t_line = binhexBegin(m)) == NULL) {
 		messageDestroy(m);
 		cli_dbgmsg("No binhex line found\n");
 		return CL_EFORMAT;
 	}
 
+	while(((t_line = t_line->t_next) != NULL) && (t_line->t_line == NULL));
+
+	if(!t_line) {
+		messageDestroy(m);
+		cli_dbgmsg("No binhex data to parse\n");
+		return CL_EFORMAT;
+	}
+
 	/* similar to binhexMessage */
 	messageSetEncoding(m, "x-binhex");
 
@@ -199,5 +208,6 @@ cli_binhex(const char *dir, fmap_t *map)
 	if(fb)
 		return CL_CLEAN;	/* a lie - but it gets things going */
 	/* return CL_EIO; */	/* probably CL_EMEM, but we can't tell at this layer */
-	return CL_EMEM;
+	/* TK: CL_EMEM is too generic here and should not be reported for parsing errors */
+	return CL_EFORMAT;
 }
diff --git a/libclamav/message.c b/libclamav/message.c
index a9366a8..659d374 100644
--- a/libclamav/message.c
+++ b/libclamav/message.c
@@ -1212,6 +1212,12 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy
 		      (t_line->t_line == NULL))
 			;
 
+		if(!t_line) {
+			cli_warnmsg("No binhex data to parse\n");
+			(*destroy)(ret);
+			return NULL;
+		}
+
 		tmp = textToBlob(t_line, NULL,
 			((m->numberOfEncTypes == 1) && (m->encodingTypes[0] == BINHEX)) ? destroy_text : 0);
 

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list