From: Greg Ames Date: Mon, 15 Oct 2001 15:32:14 +0000 (+0000) Subject: insure that a '*' in or NameVirtualHost * matches all ports. X-Git-Tag: 2.0.26~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad334fdd9051a5fceffe6b8411080d91810f0823;p=apache insure that a '*' in or NameVirtualHost * matches all ports. The recent change to eliminate the Port directive exposed this problem. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91470 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/vhost.c b/server/vhost.c index 7e164935d9..745d813439 100644 --- a/server/vhost.c +++ b/server/vhost.c @@ -194,13 +194,16 @@ static const char *get_addresses(apr_pool_t *p, const char *w_, w = apr_pstrdup(p, w_); /* apr_parse_addr_port() doesn't understand ":*" so handle that first. */ - wlen = strlen(w); - if (wlen > 2 && w[wlen - 1] == '*' && w[wlen - 2] == ':') { - w[wlen - 2] = '\0'; - wild_port = 1; - } - else { - wild_port = 0; + wlen = strlen(w); /* wlen must be > 0 at this point */ + wild_port = 0; + if (w[wlen - 1] == '*') { + if (wlen < 2) { + wild_port = 1; + } + else if (w[wlen - 2] == ':') { + w[wlen - 2] = '\0'; + wild_port = 1; + } } rv = apr_parse_addr_port(&host, &scope_id, &port, w, p); if (rv != APR_SUCCESS) {