summaryrefslogtreecommitdiff
path: root/t/op/taint.t
diff options
context:
space:
mode:
authorChip Salzenberg <chip@pobox.com>2008-11-16 15:14:30 -0800
committerH.Merijn Brand <h.m.brand@xs4all.nl>2008-11-17 07:33:24 +0000
commitec93b65fd8c6a7ae08d0f88100de0c755ed21a94 (patch)
tree1a605d52243cd606d89fa89570b5a69bc21070da /t/op/taint.t
parentd10ced8a0718a50590450dfb6f8db4eb7511a2e4 (diff)
downloadperl-ec93b65fd8c6a7ae08d0f88100de0c755ed21a94.tar.gz
Re: [perl #59998] [PATCH] crypt() returns tainted data even when input strings are detainted
Message-ID: <20081117071429.GD5495@tytlal.topaz.cx> p4raw-id: //depot/perl@34860
Diffstat (limited to 't/op/taint.t')
-rwxr-xr-xt/op/taint.t17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/op/taint.t b/t/op/taint.t
index f57842366f..29fc4362a0 100755
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -17,7 +17,7 @@ use Config;
use File::Spec::Functions;
BEGIN { require './test.pl'; }
-plan tests => 267;
+plan tests => 271;
$| = 1;
@@ -1252,6 +1252,21 @@ foreach my $ord (78, 163, 256) {
ok(!tainted($1), "\\S match with chr $ord");
}
+{
+ # 59998
+ sub cr { my $x = crypt($_[0], $_[1]); $x }
+ sub co { my $x = ~$_[0]; $x }
+ my ($a, $b);
+ $a = cr('hello', 'foo' . $TAINT);
+ $b = cr('hello', 'foo');
+ ok(tainted($a), "tainted crypt");
+ ok(!tainted($b), "untainted crypt");
+ $a = co('foo' . $TAINT);
+ $b = co('foo');
+ ok(tainted($a), "tainted complement");
+ ok(!tainted($b), "untainted complement");
+}
+
# This may bomb out with the alarm signal so keep it last
SKIP: {
skip "No alarm()" unless $Config{d_alarm};