line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- mode: perl; coding: utf-8 -*- |
2
|
|
|
|
|
|
|
package YATT::Util::Taint; |
3
|
13
|
|
|
13
|
|
71
|
use base qw(Exporter); |
|
13
|
|
|
|
|
20
|
|
|
13
|
|
|
|
|
906
|
|
4
|
13
|
|
|
13
|
|
65
|
use strict; |
|
13
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
1401
|
|
5
|
13
|
|
|
13
|
|
1318
|
use warnings qw(FATAL all NONFATAL misc); |
|
13
|
|
|
|
|
30
|
|
|
13
|
|
|
|
|
991
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
13
|
|
|
13
|
|
41
|
our @EXPORT_OK = qw(&untaint_any &is_tainted); |
9
|
13
|
|
|
|
|
2261
|
our @EXPORT = @EXPORT_OK; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
if (eval {require Scalar::Util} and not $@) { |
13
|
|
|
|
|
|
|
*is_tainted = \&Scalar::Util::tainted; |
14
|
|
|
|
|
|
|
} else { |
15
|
|
|
|
|
|
|
*is_tainted = sub { |
16
|
|
|
|
|
|
|
return not eval { eval("#" . substr(join("", @_), 0, 0)); 1 }; |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub untaint_any ($) { |
21
|
557
|
50
|
33
|
557
|
0
|
8168
|
$1 if defined $_[0] && $_[0] =~ m{(.*)}s; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |