Article View: news.software.nntp
Article #41659Re: Patch for Distribution header problem
From: Andrew Gierth
Date: Fri, 19 Nov 1999 00:00
Date: Fri, 19 Nov 1999 00:00
44 lines
2418 bytes
2418 bytes
>>>>> "Clifton" == Clifton Royston <cliftonr@lava.net> writes:
Clifton> distributions = *p ? CommaSplit(p) : NULL;
Clifton> + /* CommaSplit can perfectly well return a null pointer for the first */
I don't believe that. If CommaSplit is called with a pointer to a
non-null character, then it will return a non-null pointer (which will
point to a null char if the original text started with a comma) as the
first pointer in the array.
Specifically, CommaSplit(",") should return { "", "", NULL }.
The bug, I suspect, is really here:
if (ME.Distributions
&& !DISTwantany(ME.Distributions, distributions)) {
(void)sprintf(buff, "%d Unwanted distribution \"%s\"",
NNTP_REJECTIT_VAL,
MaxLength(distributions[0], distributions[0]));
because DISTparse can cause distributions[0] to be NULL if all the
fields returned from CommaSplit are empty, and MaxLength (prior to
your other patch) explodes if passed a NULL pointer.
Notice that this only kicks in if ME.Distributions is set; if you have
no distributions on your ME line then nothing bad seems to happen.
I'd suggest either
if (ME.Distributions
+ && distributions[0]
&& !DISTwantany(ME.Distributions, distributions)) {
(void)sprintf(buff, "%d Unwanted distribution \"%s\"",
NNTP_REJECTIT_VAL,
MaxLength(distributions[0], distributions[0]));
which will treat an article with no non-empty distributions as a
wanted article, or just use your patch to MaxLength if you prefer
to reject such articles.
--
Andrew.
Technical Details
Message-ID:
<87ogcrf3cn.fsf@erlenstar.demon.co.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.mbox.zip!not-for-mailReferences:
<8125rg$m5f$1@mochi.lava.net>Show Full Headers
Complete Article Headers
Message-ID: <87ogcrf3cn.fsf@erlenstar.demon.co.uk> Subject: Re: Patch for Distribution header problem Date: Fri, 19 Nov 1999 00:00:00 +0000 From: Andrew Gierth <andrew@erlenstar.demon.co.uk> References: <8125rg$m5f$1@mochi.lava.net> 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: 550421132 X-Mayan-Date: Long count = 12.19.6.12.17; tzolkin = 5 Caban; haab = 5 Ceh X-Complaints-To: andrew@erlenstar.demon.co.uk Organization: disorganised X-Attribution: AG X-Pgp-0x0E9FFBE9: 87 25 7F 14 41 24 B3 51 E0 19 8B DE 49 74 0C 29 X-P-Persistent-Headers: are a bad idea. Newsgroups: news.software.nntp X-Post-Filter: postfilter v0.6 alpha