Permalink
Browse files

Improperly formatted branch IP ranges can result in exceptions

  • Loading branch information...
1 parent e3c3ac4 commit ef8144390e05967005e60230508ad2eddf9f2673 @ctfliblime ctfliblime committed Feb 7, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/C4/Branch.pm
View
@@ -621,6 +621,7 @@ sub GetBranchByIp {
$ip =~ s{^(\d+)\.\*$}{$1.0.0.0/8};
$ip =~ s{^(\d+\.\d+)\.\*$}{$1.0.0/16};
$ip =~ s{^(\d+\.\d+\.\d+)\.\*$}{$1.0/24};
+ next unless $ip;
my $branch_ip = Net::IP->new($ip);
next unless $branch_ip;
return $branch->{branchcode} if $branch_ip->overlaps($client_ip);

0 comments on commit ef81443

Please sign in to comment.