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-Tag: 009~250^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=70e59e318bf542ef19bc928be288fc0159df1f8f;p=network.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 69d0c512..f8ffff70 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}