🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #87785

Re: sigsegv from vsprintf in nntpswitch

#87785
From: Richard Tobin
Date: Tue, 06 Feb 2018 17:52
49 lines
2356 bytes
In article <32b73$5a79e328$a6aa31a2$27781@news.sonic-news.com>,
Etian  <54698212@sonic-news.com> wrote:
>I am trying to run the "commercial" version which was released to the 
>public after the wrongful take-down of newsservice. I've used the free 
>version for 10 years.
>
>Software source: https://github.com/tomarus/nntpswitch
>
>It compiles, and the daemon runs fine.  But when a client connects, it 
>is disconnected and a sigsegv is logged in news.err.
>
>I used gdb to trace it to the vsprintf in this function in socket.c:
>
>  * writeclient() write to the client
>  * return 0 on success, -1 on failure
>  */
>PROTO int writeclient(CLIENT *client, char *str, ...)
>{
>	va_list ap;
>	char response[cfg.BufSize];
>
>	va_start (ap, str);
>	vsprintf (response, str, ap);
>	va_end (ap);
>
>	return swriteclient(client, response);
>}
>
>It is called from this command in nntpd.c:
>
>writeclient(client, "%u %s NNTPSwitch-%s, %u groups available, %s, slot 
>%u, connections %u\r\n",
>	client->posting ? 200 : 201,
>	client->vhost->Banner,
>	VERSION,
>	master->numgroups,
>	client->posting ? "posting allowed" : "no posting",
>	client->id + 1,
>	client->concur
>);
>
>Any ideas on what might be wrong?

The most obvious way for that code to get a segmentation fault is if
client->vhost->Banner is too long.

-- Richard

Technical Details
Message-ID: <p5cq02$1r9r$2@macpro.inf.ed.ac.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mail
References: <32b73$5a79e328$a6aa31a2$27781@news.sonic-news.com>

Show Full Headers
Complete Article Headers
Message-ID: <p5cq02$1r9r$2@macpro.inf.ed.ac.uk>
Subject: Re: sigsegv from vsprintf in nntpswitch
Date: Tue, 06 Feb 2018 17:52:02 +0000
From: richard@cogsci.ed.ac.uk (Richard Tobin)
References: <32b73$5a79e328$a6aa31a2$27781@news.sonic-news.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mail
Newsgroups: news.software.nntp
Organization: Language Technology Group, University of Edinburgh
Lines: 47
NNTP-Posting-Host: macaroni.inf.ed.ac.uk
X-Trace: macpro.inf.ed.ac.uk 1517939522 60731 129.215.197.42 (6 Feb 2018 17:52:02 GMT)
X-Complaints-To: usenet@macpro.inf.ed.ac.uk
NNTP-Posting-Date: Tue, 6 Feb 2018 17:52:02 +0000 (UTC)
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
Originator: richard@cogsci.ed.ac.uk (Richard Tobin)
X-Received-Body-CRC: 1550827051
X-Received-Bytes: 2258