Browse code

Carefully crafted binhex messages could have caused a crash

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@229 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/02/02 23:02:54
Showing 2 changed files
... ...
@@ -1,5 +1,6 @@
1 1
 Mon Feb  2 13:46:51 GMT 2004 (njh)
2 2
 ----------------------------------
3
+  * libclamav:	   Carefully crafted binhex messages could have caused a crash
3 4
   * clamav-milter: Include the ID of the message when warnings are sent to
4 5
   	postmaster-only
5 6
 
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.17  2004/02/02 14:01:58  nigelhorne
21
+ * Carefully crafted binhex messages could have caused a crash
22
+ *
20 23
  * Revision 1.16  2004/01/28 10:15:24  nigelhorne
21 24
  * Added support to scan some bounce messages
22 25
  *
... ...
@@ -45,7 +48,7 @@
45 45
  * uuencodebegin() no longer static
46 46
  *
47 47
  */
48
-static	char	const	rcsid[] = "$Id: message.c,v 1.16 2004/01/28 10:15:24 nigelhorne Exp $";
48
+static	char	const	rcsid[] = "$Id: message.c,v 1.17 2004/02/02 14:01:58 nigelhorne Exp $";
49 49
 
50 50
 #ifndef	CL_DEBUG
51 51
 /*#define	NDEBUG	/* map CLAMAV debug onto standard */
... ...
@@ -635,6 +638,13 @@ messageToBlob(const message *m)
635 635
 		}
636 636
 
637 637
 		data = blobGetData(tmp);
638
+
639
+		if(data == NULL) {
640
+			cli_warnmsg("Couldn't locate the binhex message that was claimed to be there\n");
641
+			blobDestroy(tmp);
642
+			blobDestroy(b);
643
+			return NULL;
644
+		}
638 645
 		len = blobGetDataSize(tmp);
639 646
 
640 647
 		/*
... ...
@@ -879,10 +889,8 @@ messageToText(const message *m)
879 879
 			}
880 880
 			t_line = t_line->t_next;
881 881
 		} else {
882
-			t_line = binhexBegin(m);
883
-			if(t_line) {
882
+			if(binhexBegin(m))
884 883
 				cli_warnmsg("Binhex messages not supported yet (2).\n");
885
-			} 
886 884
 			t_line = messageGetBody(m);
887 885
 		}
888 886