Skip to content

Commit

Permalink
In host_is_host_with_port, check for IPv6 address straight up w/o
Browse files Browse the repository at this point in the history
port.
  • Loading branch information
chu11 committed Jan 13, 2017
1 parent 34a37ae commit b12d30f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions common/miscutil/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,16 @@ host_is_host_with_port (const char *host, char **addr, char **port)

if (strchr (host, ':'))
{
struct sockaddr_in6 saddr;
char *addrptr;
char *portptr;
char *lastcolonptr = NULL; /* remove warning */
char *tmp;

/* First check, maybe it's a valid IPv6 address straight up */
if (inet_pton (AF_INET6, host, &saddr) == 1)
goto out;

if (!(str = strdup (host)))
goto cleanup;

Expand Down Expand Up @@ -203,6 +208,7 @@ host_is_host_with_port (const char *host, char **addr, char **port)
}
}

out:
rv = is_host_with_port;
cleanup:
free (str);
Expand Down

0 comments on commit b12d30f

Please sign in to comment.