This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
lib/locale.t: Untaint before checking if next thing taints
authorKarl Williamson <public@khwilliamson.com>
Tue, 18 Feb 2014 18:45:48 +0000 (11:45 -0700)
committerKarl Williamson <public@khwilliamson.com>
Wed, 19 Feb 2014 21:31:38 +0000 (14:31 -0700)
The tests weren't testing what they purported to, as we should be sure
to start with untained values to see if the operation taints.

lib/locale.t

index b195394..1dce940 100644 (file)
@@ -159,6 +159,14 @@ check_taint      $+;
 check_taint      $1;
 check_taint_not  $2;
 
+/(.)/; # untaint $&, $`, $', $+, $1.
+check_taint_not  $&, '/(.)/';
+check_taint_not  $`;
+check_taint_not  $';
+check_taint_not  $+;
+check_taint_not  $1;
+check_taint_not  $2;
+
 /(\s)/;        # taint $&, $`, $', $+, $1.
 check_taint      $&;
 check_taint      $`;
@@ -167,6 +175,9 @@ check_taint      $+;
 check_taint      $1;
 check_taint_not  $2;
 
+/(.)/; # untaint $&, $`, $', $+, $1.
+check_taint_not  $&, '/(.)/';
+
 /(\S)/;        # taint $&, $`, $', $+, $1.
 check_taint      $&;
 check_taint      $`;