Browse code

Corrupted binHex could crash on non Linux systems

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

Nigel Horne authored on 2004/06/02 19:11:09
Showing 1 changed files
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.59  2004/06/02 10:11:09  nigelhorne
21
+ * Corrupted binHex could crash on non Linux systems
22
+ *
20 23
  * Revision 1.58  2004/06/01 09:07:19  nigelhorne
21 24
  * Corrupted binHex could crash on non Linux systems
22 25
  *
... ...
@@ -171,7 +174,7 @@
171 171
  * uuencodebegin() no longer static
172 172
  *
173 173
  */
174
-static	char	const	rcsid[] = "$Id: message.c,v 1.58 2004/06/01 09:07:19 nigelhorne Exp $";
174
+static	char	const	rcsid[] = "$Id: message.c,v 1.59 2004/06/02 10:11:09 nigelhorne Exp $";
175 175
 
176 176
 #if HAVE_CONFIG_H
177 177
 #include "clamav-config.h"
... ...
@@ -1106,6 +1109,11 @@ messageToBlob(message *m)
1106 1106
 		 * TODO: set filename argument in message as well
1107 1107
 		 */
1108 1108
 		byte = data[0];
1109
+		if(byte >= len) {
1110
+			blobDestroy(b);
1111
+			blobDestroy(tmp);
1112
+			return NULL;
1113
+		}
1109 1114
 		filename = cli_malloc(byte + 1);
1110 1115
 		if(filename == NULL) {
1111 1116
 			blobDestroy(b);