Browse code

Fix possible segfault in handling broken RFC2047 headers

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

Nigel Horne authored on 2004/11/07 06:45:52
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sat Nov  6 21:45:21 GMT 2004 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Fix possible crash when handling illegal RFC2047 header
4
+
1 5
 Fri Nov  5 18:09:24 CET 2004 (tk)
2 6
 ---------------------------------
3 7
   * docs/MacOSX: update (Dale Enterprise L.L.C)
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.165  2004/11/06 21:43:23  nigelhorne
21
+ * Fix possible segfault in handling broken RFC2047 headers
22
+ *
20 23
  * Revision 1.164  2004/11/04 10:13:41  nigelhorne
21 24
  * Rehashed readdir_r patch
22 25
  *
... ...
@@ -480,7 +483,7 @@
480 480
  * Compilable under SCO; removed duplicate code with message.c
481 481
  *
482 482
  */
483
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.164 2004/11/04 10:13:41 nigelhorne Exp $";
483
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.165 2004/11/06 21:43:23 nigelhorne Exp $";
484 484
 
485 485
 #if HAVE_CONFIG_H
486 486
 #include "clamav-config.h"
... ...
@@ -2748,9 +2751,10 @@ rfc2047(const char *in)
2748 2748
 			pout += len;
2749 2749
 
2750 2750
 	}
2751
-	*pout = '\0';
2751
+	if(out)
2752
+		*pout = '\0';
2752 2753
 
2753
-	cli_dbgmsg("rfc2047 returns '%s'\n", out);
2754
+	cli_dbgmsg("rfc2047 returns '%s'\n", (out) ? out : "null");
2754 2755
 	return out;
2755 2756
 }
2756 2757