]> git.ipfire.org Git - people/ms/network.git/commitdiff
route: Validate input when removing static routes
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Tue, 30 May 2017 08:42:57 +0000 (10:42 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Tue, 30 May 2017 08:42:57 +0000 (10:42 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/functions/functions.route

index 079ad0b670e48bbadeb7a3cef73cae23791c89c3..c82f86ebdca4258d04af7d72ada622b18da3a17d 100644 (file)
@@ -151,7 +151,12 @@ route_add() {
 
 route_remove() {
        local _network=${1}
-       assert isset _network
+
+       # Validate input
+       if ! ip_is_network ${_network} && ! ip_is_valid ${_network}; then
+               error "Invalid IP address or network: ${_network}"
+               return ${EXIT_ERROR}
+       fi
 
        local found="false"