File: 20-tainting.t

package info (click to toggle)
libfile-map-perl 0.71-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 784 kB
  • sloc: perl: 365; ansic: 97; makefile: 3
file content (23 lines) | stat: -rw-r--r-- 512 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! perl -T

use strict;
use warnings;
use Test::More;
use Test::Fatal 'lives_ok';
use File::Map qw/:map lock_map advise/;
use Scalar::Util qw/tainted/;

plan skip_all => 'No taint support' if not tainted($0);

my $map;
lives_ok { map_file($map, $0) } 'Can map under tainting';

ok(tainted($map), 'mapped file is tainted');

ok(substr($map, 1, 10), 'substring from mapping is also tainted');

my $piece = substr($map, 1, 10);

ok(tainted($piece), 'copy of substring from mapping is also tainted');

done_testing;