provider: Fix network/netmask parsing and potential crash