From: Jonatan Schlag Date: Tue, 30 May 2017 09:26:50 +0000 (+0200) Subject: ip_is_network: Fix assertion crash when address part was invalid X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fchanges;p=people%2Fjschlag%2Fnetwork.git ip_is_network: Fix assertion crash when address part was invalid Signed-off-by: Jonatan Schlag --- diff --git a/src/functions/functions.ip b/src/functions/functions.ip index 69d0c51..f8ffff7 100644 --- a/src/functions/functions.ip +++ b/src/functions/functions.ip @@ -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}