]> granicus.if.org Git - apache/commitdiff
Fix a segfault when a numeric host (e.g., "Host: 123") was specified.
authorJeff Trawick <trawick@apache.org>
Mon, 27 Aug 2001 19:51:34 +0000 (19:51 +0000)
committerJeff Trawick <trawick@apache.org>
Mon, 27 Aug 2001 19:51:34 +0000 (19:51 +0000)
apr_parse_addr_port() assumes that if there is just a number it must
be a port, but here we need to assume that it is a host.

todo: pass a flag into apr_parse_addr_port()?  unclear whether or
      not that is cleaner overall

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90734 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/vhost.c

diff --git a/CHANGES b/CHANGES
index 15f0c3e7ba2855e4cc3a1f54eb8a3ee4d5b4e4dc..3951d8221e5cc13aadccf73f098bc4f08815c55c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.25-dev
 
+  *) Fix a segfault when a numeric value was received for Host:.
+     [Jeff Trawick]
+
   *) Add a function ap_remove_input_filter.  This is to match
      up with ap_remove_output_filter.  [Ryan Bloom]
 
index ca373e5916ee05407924fca394736ff6c0555159..7e164935d946a0bca83805b59af6fdb2331f12a6 100644 (file)
@@ -734,6 +734,14 @@ static void fix_hostname(request_rec *r)
         goto bad;
     }
 
+    if (!host && port) {
+        /* silly looking host ("Host: 123") but that isn't our job
+         * here to judge; apr_parse_addr_port() would think we had a port
+         * but no address
+         */
+        host = apr_psprintf(r->pool, "%d", (int)port);
+    }
+
     /* if the hostname is an IPv6 numeric address string, it was validated 
      * already; otherwise, further validation is needed 
      */