diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-19 23:30:28 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-19 23:30:28 +0200 |
commit | 553f06d3ecdb93a9ddbe6c74d4411cc1d8a642a5 (patch) | |
tree | c6d1fdbaaa3f20e9733a4d692f6b2951db8edfd7 | |
parent | b947a2e4bc6b944191bca1b521b15004110c04b6 (diff) | |
download | xK-553f06d3ecdb93a9ddbe6c74d4411cc1d8a642a5.tar.gz xK-553f06d3ecdb93a9ddbe6c74d4411cc1d8a642a5.tar.xz xK-553f06d3ecdb93a9ddbe6c74d4411cc1d8a642a5.zip |
degesch: fix literal IPv6 server addresses
-rw-r--r-- | degesch.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -4385,7 +4385,7 @@ irc_on_connector_connected (void *user_data, int socket) static void irc_split_host_port (char *s, char **host, char **port) { - char *colon = strchr (s, ':'); + char *colon = strrchr (s, ':'); if (colon) { *colon = '\0'; @@ -4394,6 +4394,11 @@ irc_split_host_port (char *s, char **host, char **port) else *port = "6667"; + // Unwrap IPv6 addresses in format_host_port_pair() format + size_t host_end = strlen (s) - 1; + if (*s == '[' && s[host_end] == ']') + s++[host_end] = '\0'; + *host = s; } |