Thread View: news.software.nn
1 messages
1 total messages
Started by Henk de Groot
Wed, 31 Aug 1994 13:22
Bug in nn 6.5.0.b3
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads