🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #11623

bug in expireover

#11623
From: T. William Wells
Date: Sun, 13 Oct 1996 00:00
24 lines
1298 bytes
I was just looking over expireover because I've become tired of
the memory it uses and found -- a bug!

In RemoveLines, where it's allocating space to read in the entire
overview file, it checks to see if there's enough space in the
existing alloction. With this:

    else if (B.Size < Sb.st_size) {

The problem is that the buffer size must be one *greater* than
the file size, to accomodate a trailing nul. So if there happens
to be an overview file that's exactly one byte larger than the
previous largest file, a nul byte gets written past the end of
allocated memory. There's a similar bug in AddLines.

The fix is to make it

    else if (B.Size <= Sb.st_size) {

Also, START_LIST_SIZE is 128; in this age of huge news spools,
that's ridiculously small. 4096 is a much more reasonable number.

Technical Details
Message-ID: <53s1fj$71r@twwells.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.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <53s1fj$71r@twwells.com>
Subject: bug in expireover
Date: Sun, 13 Oct 1996 00:00:00 +0000
From: bill@twwells.com (T. William Wells)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 189351123
Organization: None, Mt. Laurel, NJ
Newsgroups: news.software.nntp