Article View: news.software.nn
Article #6366Bug in nn 6.5.0.b3
From: Henk de Groot
Date: Wed, 31 Aug 1994 13:22
Date: Wed, 31 Aug 1994 13:22
62 lines
2782 bytes
2782 bytes
I recently tracked down an error in the latest beta version. If for some
reason the NNTP server is not reachable (because the name service can not
be reached, or the server name is wrong) than NN dumps core (On AT&T
system V.3 at least).
I found out that the core dump is caused by a bad implementation of
nntp_check in the file nntp.c. The implementation uses the result of
gethostbyname() directly without checking if gethostbyname() return NULL.
Here is what I did to it, it is a quick hack and not nice at all but it
doesn't dump core. I can not send a c-diff because I did some other things
to nntp.c too, and the lines would not match up with the original file.
---------------------------------------------------------------------------
/*
* 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];
char *server_real_name;
struct hostent *hp;
if (nntp_local_server) return;
find_server();
nn_gethostname(host, sizeof host);
hp = gethostbyname(host);
if(hp != NULL)
strncpy(host, hp->h_name, sizeof host);
else
strncpy(host, "???", sizeof host);
hp = gethostbyname(nntp_server);
if(hp != NULL) {
server_real_name = hp->h_name;
} else {
server_real_name = "noname";
}
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 */
}
}
---------------------------------------------------------------------------
--
/ / de Groot Dep: ALD2 | E-Mail: groot@apd.dec.com
/---/ __ __ / Tel: +31 55 432104 | Corp: Digital Equipment Corporation
/ / (-_ / / /( Loc: FP-B09 | Site: Apeldoorn, The Netherlands
Technical Details
Message-ID:
<groot.778339377@taren2la.apd.dec.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!panix!zip.eecs.umich.edu!yeshua.marcam.com!usc!howland.reston.ans.net!EU.net!sun4nl!philapd!apdnews!taren2la.apd.dec.com!grootShow Full Headers
Complete Article Headers
Message-ID: <groot.778339377@taren2la.apd.dec.com> Subject: Bug in nn 6.5.0.b3 Date: Wed, 31 Aug 1994 13:22:57 +0000 From: groot@apd.dec.com (Henk de Groot) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!panix!zip.eecs.umich.edu!yeshua.marcam.com!usc!howland.reston.ans.net!EU.net!sun4nl!philapd!apdnews!taren2la.apd.dec.com!groot Newsgroups: news.software.nn Sender: news@apd.dec.com Reply-To: groot@apd.dec.com (Henk de Groot) Lines: 62 X-Disclaimer: This opinion is mine alone