Received: (at bugs) by bugs.debian.org; 16 Mar 1997 05:15:26 +0000 Received: (qmail 21515 invoked from network); 16 Mar 1997 05:15:25 -0000 Received: from smtp1.xs4all.nl (194.109.6.51) by master.debian.org with SMTP; 16 Mar 1997 05:15:24 -0000 Received: from magigimmix.xs4all.nl (magigimmix.xs4all.nl [194.109.6.25]) by smtp1.xs4all.nl (8.7.6/XS4ALL) with ESMTP id GAA20434 for ; Sun, 16 Mar 1997 06:06:09 +0100 (MET) Received: from xs1.xs4all.nl (xs1.xs4all.nl [194.109.6.42]) by magigimmix.xs4all.nl (8.7.6/XS4ALL) with ESMTP id GAA09357 for ; Sun, 16 Mar 1997 06:06:08 +0100 (MET) Received: (from dark@localhost) by xs1.xs4all.nl (8.7.6/XS4ALL) id GAA04489 for bugs@bugs.debian.org; Sun, 16 Mar 1997 06:06:08 +0100 (MET) From: Richard Braakman Message-Id: <199703160506.GAA04489@xs1.xs4all.nl> Subject: nn dumps core if NNTPSERVER is invalid To: bugs@bugs.debian.org Date: Sun, 16 Mar 1997 06:06:08 +0100 (MET) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Package: nn Version: 6.5.0.b3.linux.1.1-01 When I start nn while the environment variable NNTPSERVER cannot be found by gethostbyname(), it dumps core immediately. I have traced the problem to the function nntp_check() in nntp.c. I quote it here. The problem line has been marked with an arrow in the left margin. /* * nntp_check: Find out whether we need to use NNTP. * * This is done by comparing the NNTP servers name with whatever * nn_gethostname() returns. * use_nntp and news_active are initialised as a side effect. */ nntp_check() { char host[128]; const char *server_real_name; if (nntp_local_server) return; find_server(); nn_gethostname(host, sizeof host); strncpy(host, (gethostbyname(host))->h_name, sizeof host); --> server_real_name = (gethostbyname(nntp_server))->h_name; use_nntp = (strcmp(host, server_real_name) != 0); if (use_nntp) { freeobj(news_active); #ifndef NOV news_active = mk_file_name(db_directory, "ACTIVE"); #else /* NOV */ news_active = mk_file_name(nn_directory, "ACTIVE"); #endif /* NOV */ } } The function gethostbyname() will return 0 if the lookup fails for any reason. The subsequent dereference will cause the program to dump core.