]> git.ipfire.org Git - people/ms/network.git/commitdiff
ip_is_network: Fix assertion crash when address part was invalid
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Tue, 30 May 2017 09:26:50 +0000 (11:26 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Tue, 30 May 2017 09:26:50 +0000 (11:26 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/functions/functions.ip

index 69d0c512cdf79a648bef3d37ec9797b983034ebb..f8ffff7044a170d610402f96b80659fdf14596ed 100644 (file)
@@ -91,9 +91,10 @@ ip_is_network() {
        local prefix=$(ip_get_prefix ${network})
        isset prefix || return ${EXIT_FALSE}
 
-       # Detect the protocol.
+       # Detect the protocol (if this fails, the
+       # address part is invalid)
        local proto=$(ip_detect_protocol ${address})
-       assert isset proto
+       isset proto || return ${EXIT_FALSE}
 
        # Check if the prefix is correct.
        ip_prefix_is_valid ${proto} ${prefix} || return ${EXIT_FALSE}