This is to ensure that tcpip_getaddrinfo for bind host do not
accidently use : from IPV6 address.
if (bind_host)
{
tcpip_state *sp = (tcpip_state *) p->cprivate;
- sp->bind_host = xstrdup(bind_host);
+ char *cp;
+ sp->bind_host = xmalloc(strlen(bind_host) + 4);
+ strcpy(sp->bind_host, bind_host);
+ cp = strrchr(sp->bind_host, ':');
+
+ if (!cp || cp[1] == '\0')
+ strcat(sp->bind_host, ":0");
+ else
+ strcpy(cp, ":0");
}
if (connect_host)
{