ipv6 = 1;
} else {
field = p;
- for (; *p && *p != ':' && *p != ' ' && *p != '\t' && *p != '\n'; p++);
+ for (; *p && *p != ':' && *p != '/' && *p != ' ' && *p != '\t' && *p != '\n'; p++);
}
if (field == p) {
debug(DBG_ERR, "missing host/address");
hp->host = stringcopy(field, p - field);
if (ipv6) {
p++;
- if (*p && *p != ':' && *p != ' ' && *p != '\t' && *p != '\n') {
+ if (*p && *p != ':' && *p != '/' && *p != ' ' && *p != '\t' && *p != '\n') {
debug(DBG_ERR, "unexpected character after ]");
return 0;
}
hp->host = NULL;
}
- slash = hp->host ? strchr(hp->host, '/') : NULL;
+ slash = hostport ? strchr(hostport, '/') : NULL;
if (slash) {
if (!prefixok) {
debug(DBG_WARN, "newhostport: prefix not allowed here", hp->host);
goto errexit;
}
hp->prefixlen = plen;
- *slash = '\0';
} else
hp->prefixlen = 255;
return hp;