]> granicus.if.org Git - apache/commitdiff
insure that a '*' in <VirtualHost *> or NameVirtualHost * matches all ports.
authorGreg Ames <gregames@apache.org>
Mon, 15 Oct 2001 15:32:14 +0000 (15:32 +0000)
committerGreg Ames <gregames@apache.org>
Mon, 15 Oct 2001 15:32:14 +0000 (15:32 +0000)
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

server/vhost.c

index 7e164935d946a0bca83805b59af6fdb2331f12a6..745d81343955f02edd5b396a026939308968123c 100644 (file)
@@ -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) {