Hi,

The attached patch should fix the segfault when /etc/hostname is wrong.
It should use the value returned by gethostname() in case of problem.

Regards,
Regis
-- 
"While a monkey can be a manager, it takes a human to be an engineer"
                        Erik Zapletal
diff -urN nn-6.6.5.bc/nntp.c nn-6.6.5/nntp.c
--- nn-6.6.5.bc/nntp.c	2005-08-03 21:50:15.199793736 +0100
+++ nn-6.6.5/nntp.c	2005-08-03 21:46:02.735174192 +0100
@@ -826,7 +826,9 @@
     if (nntp_local_server) return;
 
     find_server();
-    strncpy(host_name, (gethostbyname(host_name))->h_name, sizeof host_name);
+	hp = gethostbyname(host_name);
+	if ((hp != NULL) && (hp->h_name != NULL))
+		strncpy(host_name, hp->h_name, sizeof host_name);
 
     if ((hp = gethostbyname(nntp_server)) != NULL)
 	server_real_name = hp->h_name;

Reply via email to