[v2,1/4] Network::network_equal: fix check if array is fully defined

Message ID 20180212221932.29122-2-berny156@gmx.de
State Dropped
Headers show
Series proxy.cgi fixes for bugzilla #10852 | expand

Commit Message

Bernhard Held Feb. 13, 2018, 9:19 a.m. UTC
Correctly check length of list.
Credit to Bernhard Bitsch for pointing in the right direction.
---
 config/cfgroot/network-functions.pl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl
index 2902aabb0..93bb646a6 100644
--- a/config/cfgroot/network-functions.pl
+++ b/config/cfgroot/network-functions.pl
@@ -111,8 +111,9 @@  sub network_equal {
 	my @bin1 = &network2bin($network1);
 	my @bin2 = &network2bin($network2);
 
-	if (!defined $bin1 || !defined $bin2) {
-		return undef;
+   unless (scalar @bin1 == 2 &&
+	        scalar @bin2 == 2) {
+		return;
 	}
 
 	if ($bin1[0] eq $bin2[0] && $bin1[1] eq $bin2[1]) {