develooper Front page | perl.perl5.porters | Postings from November 2009

Re: [perl #67962] spamassassin and tainted mode

Thread Previous | Thread Next
From:
Mark Martinec
Date:
November 5, 2009 14:49
Subject:
Re: [perl #67962] spamassassin and tainted mode
Message ID:
200911052128.10521.Mark.Martinec@ijs.si
Yves,


> > I'm running 5.10.1 on our mailers now. I suppose I could
> > remove these localizations of $1,$2,etc and see what happens.
> > Will let you know if I can reproduce it on 5.10.1.

Done. And I believe I have it distilled now to a small test case.

> Also it would be really nice to get to the bottom of this.
> 
> I have looked at the regex code and i have looked at the $1 fetch
> logic and i dont see how it possibly could ever be tainted.
> 
> At the very least we should assert that it isnt.

#!/usr/bin/perl -T

  use strict;
  use re 'taint';
  use Scalar::Util qw(tainted);

  my $mailbox = 'abc@example.com';
  $mailbox .= substr($ENV{PATH},0,0);  # make it tainted

  # $1 and $2 become tainted
  my(@r) = $mailbox =~ /^(.*?)(\@.*)$/ ? ($1,$2) : ($mailbox,'');
  printf("%d %d\n", tainted($1), tainted($2));

  my($nm) = 'aaa-ccc';  # not tainted
  printf("%d\n", tainted($nm));

  $nm =~ s/^aaa-(.*)$/$1/;  # $nm becomes tainted
  printf("%d\n", tainted($nm));



Mark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About