develooper Front page | perl.perl5.porters | Postings from February 2000

Re: [PATCH] myriad bugs in std modules, w/ security problems

From:
Tom Christiansen
Date:
February 27, 2000 16:08
Subject:
Re: [PATCH] myriad bugs in std modules, w/ security problems
Message ID:
16527.951696520@chthon
>I don't think this is strictly needed.  Doesn't "^" always means beginning
>of string, unless /m is specified?

I'm an old foggy, and a paranoid one.

--tom

#!/usr/bin/perl
# dupwords
$| = 1;
undef $/; 
$* = 1;
while ( $ARGV = shift ) { 
    if (!open ARGV) { warn "$ARGV: $!\n"; next; } 
    $_ = <ARGV>;
    s/\b(\s?)(([A-Za-z]\w*)(\s+\3)+\b)/$1\200$2\200/gi || next;
    split(/\n/);
    $NR = 0;
    @hits = ();
    for (@_) { 
	$NR++;
	push(@hits, sprintf("%5d %s", $NR, $_)) if /\200/;
    } 
    $_ = join("\n",@hits);
    s/\200([^\200]+)\200/[* $1 *]/g;
    print "$ARGV:\n$_\n";
}



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