host: Properly handle NULL in host_create_from_string[_and_family]
[strongswan.git] / src / libstrongswan / networking / host.c
index 07da3ef..2e464b0 100644 (file)
@@ -354,6 +354,10 @@ host_t *host_create_from_string_and_family(char *string, int family,
                struct sockaddr_in6 v6;
        } addr;
 
+       if (!string)
+       {
+               return NULL;
+       }
        if (streq(string, "%any"))
        {
                return host_create_any_port(family ? family : AF_INET, port);