diff options
| author | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2020-08-04 21:10:27 +0200 |
|---|---|---|
| committer | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2020-08-04 21:15:19 +0200 |
| commit | ec8ff2e14f4f6d69282b21def9f2f0fc64116b21 (patch) | |
| tree | 519481573879a7e01d88350e788ce0b6f0b50b30 /challenge-072 | |
| parent | 8aeb4e2c74c70428cc82c52bb94c08a2f48dcd4e (diff) | |
| download | perlweeklychallenge-club-ec8ff2e14f4f6d69282b21def9f2f0fc64116b21.tar.gz perlweeklychallenge-club-ec8ff2e14f4f6d69282b21def9f2f0fc64116b21.tar.bz2 perlweeklychallenge-club-ec8ff2e14f4f6d69282b21def9f2f0fc64116b21.zip | |
untaint arguments
Diffstat (limited to 'challenge-072')
| -rwxr-xr-x | challenge-072/jo-37/perl/ch-2.pl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/challenge-072/jo-37/perl/ch-2.pl b/challenge-072/jo-37/perl/ch-2.pl index 423ed6ca80..95a529b5a5 100755 --- a/challenge-072/jo-37/perl/ch-2.pl +++ b/challenge-072/jo-37/perl/ch-2.pl @@ -1,10 +1,12 @@ -#!/usr/bin/perl +#!/usr/bin/perl -T use strict; use warnings; sub print_range { - my ($file, $A, $B) = (shift, shift() + 0, shift() + 0); + my $file = shift; + my ($A) = shift =~ /^(\d+)/; + my ($B) = shift =~ /^(\d+)/; return if !$file || $A < 1 || $B < $A; @@ -18,4 +20,8 @@ EOS close $fh or warn "$file: $!\n"; } -print_range 'ch-2.in', 3, 5; +if (@ARGV) { + print_range @ARGV; +} else { + print_range 'ch-2.in', 3, 5; +} |
