πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #87974

Re: Cleanfeed bug in yEnc handling

#87974
From: Steve Crook
Date: Sat, 01 Jun 2019 20:05
52 lines
3011 bytes
On Sat, 1 Jun 2019 21:31:05 +0200, Julien Γ‰LIE wrote in
Message-Id: <qcujpu$n86$1@news.trigofacile.com>:

> Hi Steve,
>>> Cleanfeed's matching of yEnc lines is a little too strict, and this has
>>> lead to spam with header lines like:
>>>
>>> ## =ybegin line=128 size=716800 name=a
>>
>> @@ -1614,12 +1614,14 @@ sub is_binary {
>>       # =ybegin.
>>       if ($body =~ /(?:^|\n)=ybegin$hws+(.+)/o) {
>>           local $_ = $1;
>> -        # Further confirmation that this is a yEnc message and extract
>> -        # the file extension.  Greedy is good in this instance.
>> -        if (/line=/ and /size=/ and /name=.*\.(\w{2,4})/) {
>> -            $state{file_extension} = $1;
>> -            $state{cache_is_binary} = "yEnc Encoded";
>> -            return $state{cache_is_binary};
>> +        if (/line=/ and /size=/) {
>> +           # Further confirmation that this is a yEnc message and extract the
>> +           # file extension.  Greedy is good in this instance.
>> +            if (/name=.*\.(\w{2,4})/) {
>> +                $state{file_extension} = $1;
>> +                $state{cache_is_binary} = "yEnc Encoded";
>> +                return $state{cache_is_binary};
>> +            };
>>           };
>>       };
>
> If we have "name=a" (without extension), like in "=ybegin line=128 
> size=716800 name=a", I think the if-statement won't catch it.

Hi Julien,

I agree, the regex in both the original and the proposed patch won't
catch a filename without a period and an extension.  It looks
like the intention was to enforce an extension of 2-4 ascii characters
but there's no termination on the regex it so it would match an
extension of anything over 2 chars.

I checked out the yEnc spec and it doesn't appear to enforce any
particular filename format.  I think the best option would be to just
check for:-
/line=/ and /size=/ and /name=/ in a =ybegin line.  Would you agree?

-- 
What shall we use 
To fill the empty spaces 
Where we used to talk?

Technical Details
Message-ID: <slrnqf5mjo.u39.steve@fleegle.mixmin.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.(19219).mbox.7z!not-for-mail
References: <np3d0jyr846.fsf@sanger.ac.uk> <slrnqf5692.u39.steve@fleegle.mixmin.net> <qcujpu$n86$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrnqf5mjo.u39.steve@fleegle.mixmin.net>
Subject: Re: Cleanfeed bug in yEnc handling
Date: Sat, 01 Jun 2019 20:05:12 +0000
From: Steve Crook <steve@mixmin.net>
References: <np3d0jyr846.fsf@sanger.ac.uk> <slrnqf5692.u39.steve@fleegle.mixmin.net> <qcujpu$n86$1@news.trigofacile.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: Mixmin
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 1 Jun 2019 20:05:12 -0000 (UTC)
Injection-Info: news.mixmin.net; posting-host="c4af4a3027e8317d29ea238d8aa6bb2f616aa3fc";
 logging-data="7816"; mail-complaints-to="abuse@mixmin.net"
User-Agent: slrn/pre1.0.4-2 (Linux)
X-Received-Bytes: 2905
X-Received-Body-CRC: 3654400484