]> granicus.if.org Git - apache/commitdiff
Merge r1523235 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 17 Sep 2013 18:43:30 +0000 (18:43 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 17 Sep 2013 18:43:30 +0000 (18:43 +0000)
mod_cache: Avoid a crash with strcmp() when the hostname is not provided.

Submitted by: minfrin
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1524167 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/cache/cache_storage.c

diff --git a/CHANGES b/CHANGES
index 890fb6b2f2aa2be676ffd5427b05fe21cc023a70..5bf2455c48d18d9751428c6ca146d7cb1916d3af 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.7
 
+  *) mod_cache: Avoid a crash with strcmp() when the hostname is not provided.
+     [Graham Leggett]
+
   *) mod_headers: Add 'Header note header-name note-name' for copying a response
      headers value into a note. [Eric Covener]
 
index af60a39b84ff36367c96bcfd6a6878663b7a6294..782dc712fcfc2639c646c895977a739258170f47 100644 (file)
@@ -713,7 +713,9 @@ int cache_invalidate(cache_request_rec *cache, request_rec *r)
                 || APR_SUCCESS
                         != cache_canonicalise_key(r, r->pool, location,
                                 &location_uri, &location_key)
-                || strcmp(r->parsed_uri.hostname, location_uri.hostname)) {
+                || !(r->parsed_uri.hostname && location_uri.hostname
+                        && !strcmp(r->parsed_uri.hostname,
+                                location_uri.hostname))) {
             location_key = NULL;
         }
     }
@@ -726,8 +728,9 @@ int cache_invalidate(cache_request_rec *cache, request_rec *r)
                 || APR_SUCCESS
                         != cache_canonicalise_key(r, r->pool, content_location,
                                 &content_location_uri, &content_location_key)
-                || strcmp(r->parsed_uri.hostname,
-                        content_location_uri.hostname)) {
+                || !(r->parsed_uri.hostname && content_location_uri.hostname
+                        && !strcmp(r->parsed_uri.hostname,
+                                content_location_uri.hostname))) {
             content_location_key = NULL;
         }
     }