diff options
Diffstat (limited to 'ctdb/protocol')
-rw-r--r-- | ctdb/protocol/protocol_util.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c index 0a0998f1847..c5d0eb6480e 100644 --- a/ctdb/protocol/protocol_util.c +++ b/ctdb/protocol/protocol_util.c @@ -240,6 +240,19 @@ static int ip_from_string(const char *str, ctdb_sock_addr *addr) static const uint8_t ipv4_mapped_prefix[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff }; + size_t len = strlen(str); + char s[64]; + + len = strlcpy(s, str, sizeof(s)); + if (len >= sizeof(s)) { + return EINVAL; + } + + if ((len >= 2) && (s[0] == '[') && (s[len-1] == ']')) { + s[len-1] = '\0'; + str = s+1; + p = strrchr(str, ':'); + } ret = ipv6_from_string(str, &addr->ip6); if (ret != 0) { |