Skip to content

Commit

Permalink
Fixed Validation Bug
Browse files Browse the repository at this point in the history
Fixed a bug that was allowing some invalid values for some keys through.
  • Loading branch information
Bart Busscots committed Aug 13, 2014
1 parent dc9495a commit c9e7747
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions XKPasswd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ my $_KEYS = {
my $key = shift;
unless(scalar @{$key} >= 2){ return 0; }
foreach my $symbol (@{$key}){
unless(ref $symbol eq q{} && $symbol =~ m/^.$/sx){ return 0; }
unless(ref $symbol eq q{} && length $symbol == 1){ return 0; }
}
return 1;
},
Expand All @@ -71,7 +71,7 @@ my $_KEYS = {
my $key = shift;
unless(scalar @{$key} >= 2){ return 0; }
foreach my $symbol (@{$key}){
unless(ref $symbol eq q{} && $symbol =~ m/^.$/sx){ return 0; }
unless(ref $symbol eq q{} && length $symbol == 1){ return 0; }
}
return 1;
},
Expand Down Expand Up @@ -112,7 +112,7 @@ my $_KEYS = {
ref => q{}, # SCALAR
validate => sub {
my $key = shift;
unless($key =~ m/^(.)|(NONE)|(RANDOM)$/sx){ return 0; }
unless(length $key == 1 || $key =~ m/^(NONE)|(RANDOM)$/sx){ return 0; }
return 1;
},
desc => q{A scalar containing a single character, or the special value 'NONE' or 'RANDOM'},
Expand Down Expand Up @@ -182,7 +182,7 @@ my $_KEYS = {
ref => q{}, # SCALAR
validate => sub {
my $key = shift;
unless($key =~ m/^[.]|(NONE)|(RANDOM)|(SEPARATOR)$/sx){return 0; }
unless(length $key == 1 || $key =~ m/^(NONE)|(RANDOM)|(SEPARATOR)$/sx){return 0; }
return 1;
},
desc => q{A scalar containing a single character or one of the special values 'NONE', 'RANDOM', or 'SEPARATOR'},
Expand Down

0 comments on commit c9e7747

Please sign in to comment.