Skip to content

Commit 575f7bd

Browse files
committed
* Version 71 with advisory from @fweimer
1 parent 86d9415 commit 575f7bd

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

Changes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
[Changes for 0.71 - Tue Jun 4 18:24:10 CST 2013]
2+
3+
* Constrain the user-specified digest name to /^\w+\d+$/.
4+
5+
* Avoid loading Digest::* from relative paths in @INC.
6+
7+
Contributed by: Florian Weimer
8+
19
[Changes for 0.70 - Thu Nov 29 01:45:54 CST 2012]
210

311
* Don't check gpg version if gpg does not exist.

META.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ requires:
2525
perl: 5.005
2626
resources:
2727
repository: http://github.com/audreyt/module-signature
28-
version: 0.70
28+
version: 0.71

lib/Module/Signature.pm

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package Module::Signature;
2-
$Module::Signature::VERSION = '0.70';
2+
$Module::Signature::VERSION = '0.71';
33

44
use 5.005;
55
use strict;
@@ -532,18 +532,23 @@ sub _mkdigest {
532532

533533
sub _digest_object {
534534
my($algorithm) = @_;
535+
536+
# Avoid loading Digest::* from relative paths in @INC.
537+
local @INC = grep { /^[^.]/ } @INC;
538+
539+
# Constrain algorithm name to be of form ABC123.
540+
my ($base, $variant) = ($algorithm =~ /^([_a-zA-Z]+)([0-9]+)$/g)
541+
or die "Malformed algorithm name: $algorithm (should match /\\w+\\d+/)";
542+
535543
my $obj = eval { Digest->new($algorithm) } || eval {
536-
my ($base, $variant) = ($algorithm =~ /^(\w+?)(\d+)$/g) or die;
537544
require "Digest/$base.pm"; "Digest::$base"->new($variant)
538545
} || eval {
539546
require "Digest/$algorithm.pm"; "Digest::$algorithm"->new
540547
} || eval {
541-
my ($base, $variant) = ($algorithm =~ /^(\w+?)(\d+)$/g) or die;
542548
require "Digest/$base/PurePerl.pm"; "Digest::$base\::PurePerl"->new($variant)
543549
} || eval {
544550
require "Digest/$algorithm/PurePerl.pm"; "Digest::$algorithm\::PurePerl"->new
545551
} or do { eval {
546-
my ($base, $variant) = ($algorithm =~ /^(\w+?)(\d+)$/g) or die;
547552
warn "Unknown cipher: $algorithm, please install Digest::$base, Digest::$base$variant, or Digest::$base\::PurePerl\n";
548553
} and return } or do {
549554
warn "Unknown cipher: $algorithm, please install Digest::$algorithm\n"; return;

0 commit comments

Comments
 (0)