Browse code

Improved handling of /etc/hosts file

git-svn: trunk@2540

Nigel Horne authored on 2006/12/06 23:54:22
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Dec  6 14:53:39 GMT 2006 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Improved handling of incorrect /etc/hosts files
4
+
1 5
 Tue Dec  5 03:18:06 CET 2006 (tk)
2 6
 ---------------------------------
3 7
   * libclamav/unrar/unrar.c: fix return value of rar_unpack() (bb#182)
... ...
@@ -24,9 +24,9 @@
24 24
  *
25 25
  * For installation instructions see the file INSTALL that came with this file
26 26
  */
27
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.301 2006/12/02 15:17:02 njh Exp $";
27
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.302 2006/12/06 14:53:24 njh Exp $";
28 28
 
29
-#define	CM_VERSION	"devel-021206"
29
+#define	CM_VERSION	"devel-061206"
30 30
 
31 31
 #if HAVE_CONFIG_H
32 32
 #include "clamav-config.h"
... ...
@@ -3202,7 +3202,8 @@ clamfi_eom(SMFICTX *ctx)
3202 3202
 				 */
3203 3203
 				struct hostent hostent;
3204 3204
 
3205
-				if(r_gethostbyname(hostname, &hostent, buf, sizeof(buf)) == 0)
3205
+				if((r_gethostbyname(hostname, &hostent, buf, sizeof(buf)) == 0) &&
3206
+				   hostent.h_name)
3206 3207
 					strncpy(hostname, hostent.h_name, sizeof(hostname));
3207 3208
 			}
3208 3209