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)
{