summaryrefslogtreecommitdiff
path: root/t/op/taint.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-02-28 15:17:17 +0000
committerNicholas Clark <nick@ccl4.org>2011-02-28 15:17:17 +0000
commit281a340fc9949f59cf3ae61917913b16c8924ce1 (patch)
tree68bc60d3462dfce72d414004952c92d2fe8df202 /t/op/taint.t
parent1596350e769e1efc9293fbfbe51aca23a695b5fb (diff)
downloadperl-281a340fc9949f59cf3ae61917913b16c8924ce1.tar.gz
Convert the taint.t Fcntl tests to use tempfile(), instead of "foo".
tempfile() also automatically deletes all of its temporary files.
Diffstat (limited to 't/op/taint.t')
-rw-r--r--t/op/taint.t29
1 files changed, 14 insertions, 15 deletions
diff --git a/t/op/taint.t b/t/op/taint.t
index a940493f8d..7dcc93716d 100644
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -1469,7 +1469,8 @@ SKIP: {
SKIP: {
skip "no Fcntl", 18 unless $has_fcntl;
- my $evil = "foo" . $TAINT;
+ my $foo = tempfile();
+ my $evil = $foo . $TAINT;
eval { sysopen(my $ro, $evil, &O_RDONLY) };
test $@ !~ /^Insecure dependency/, $@;
@@ -1489,43 +1490,41 @@ SKIP: {
eval { sysopen(my $tr, $evil, &O_TRUNC) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $ro, "foo", &O_RDONLY | $TAINT0) };
+ eval { sysopen(my $ro, $foo, &O_RDONLY | $TAINT0) };
test $@ !~ /^Insecure dependency/, $@;
- eval { sysopen(my $wo, "foo", &O_WRONLY | $TAINT0) };
+ eval { sysopen(my $wo, $foo, &O_WRONLY | $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $rw, "foo", &O_RDWR | $TAINT0) };
+ eval { sysopen(my $rw, $foo, &O_RDWR | $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $ap, "foo", &O_APPEND | $TAINT0) };
+ eval { sysopen(my $ap, $foo, &O_APPEND | $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $cr, "foo", &O_CREAT | $TAINT0) };
+ eval { sysopen(my $cr, $foo, &O_CREAT | $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $tr, "foo", &O_TRUNC | $TAINT0) };
+ eval { sysopen(my $tr, $foo, &O_TRUNC | $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $ro, "foo", &O_RDONLY, $TAINT0) };
+ eval { sysopen(my $ro, $foo, &O_RDONLY, $TAINT0) };
test $@ !~ /^Insecure dependency/, $@;
- eval { sysopen(my $wo, "foo", &O_WRONLY, $TAINT0) };
+ eval { sysopen(my $wo, $foo, &O_WRONLY, $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $rw, "foo", &O_RDWR, $TAINT0) };
+ eval { sysopen(my $rw, $foo, &O_RDWR, $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $ap, "foo", &O_APPEND, $TAINT0) };
+ eval { sysopen(my $ap, $foo, &O_APPEND, $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $cr, "foo", &O_CREAT, $TAINT0) };
+ eval { sysopen(my $cr, $foo, &O_CREAT, $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
- eval { sysopen(my $tr, "foo", &O_TRUNC, $TAINT0) };
+ eval { sysopen(my $tr, $foo, &O_TRUNC, $TAINT0) };
test $@ =~ /^Insecure dependency/, $@;
-
- unlink("foo"); # not unlink($evil), because that would fail...
}
}